12-05-2026 Frontend dev
This commit is contained in:
parent
405df0a122
commit
5b8bdf4182
779 changed files with 480564 additions and 6241 deletions
30
database/factories/AdminPresetFactory.php
Normal file
30
database/factories/AdminPresetFactory.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\AdminPreset;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<AdminPreset>
|
||||
*/
|
||||
class AdminPresetFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'key' => 'test.'.fake()->unique()->slug(),
|
||||
'area' => 'test',
|
||||
'type' => 'text',
|
||||
'label' => fake()->sentence(3),
|
||||
'value' => fake()->paragraph(),
|
||||
'payload' => null,
|
||||
'is_active' => true,
|
||||
];
|
||||
}
|
||||
}
|
||||
33
database/factories/BillingAddressFactory.php
Normal file
33
database/factories/BillingAddressFactory.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\BillingAddress;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<BillingAddress>
|
||||
*/
|
||||
class BillingAddressFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => User::factory(),
|
||||
'salutation_key' => fake()->randomElement(['mr', 'mrs', 'diverse']),
|
||||
'title' => fake()->optional()->randomElement(['Dr.', 'Prof.']),
|
||||
'name' => fake()->company(),
|
||||
'address1' => fake()->streetAddress(),
|
||||
'address2' => fake()->optional()->secondaryAddress(),
|
||||
'postal_code' => fake()->postcode(),
|
||||
'city' => fake()->city(),
|
||||
'country_code' => 'DE',
|
||||
];
|
||||
}
|
||||
}
|
||||
33
database/factories/CategoryFactory.php
Normal file
33
database/factories/CategoryFactory.php
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Models\Category;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<Category>
|
||||
*/
|
||||
class CategoryFactory extends Factory
|
||||
{
|
||||
protected $model = Category::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'portal' => fake()->randomElement([Portal::Presseecho->value, Portal::Businessportal24->value, Portal::Both->value]),
|
||||
'is_active' => true,
|
||||
];
|
||||
}
|
||||
|
||||
public function withTranslations(): static
|
||||
{
|
||||
return $this->afterCreating(function (Category $category): void {
|
||||
$category->translations()->createMany([
|
||||
['locale' => 'de', 'name' => fake('de_DE')->words(2, true), 'slug' => 'de-'.fake()->unique()->slug(2)],
|
||||
['locale' => 'en', 'name' => fake('en_US')->words(2, true), 'slug' => 'en-'.fake()->unique()->slug(2)],
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
50
database/factories/CompanyFactory.php
Normal file
50
database/factories/CompanyFactory.php
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\CompanyType;
|
||||
use App\Enums\Portal;
|
||||
use App\Models\Company;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends Factory<Company>
|
||||
*/
|
||||
class CompanyFactory extends Factory
|
||||
{
|
||||
protected $model = Company::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$name = fake()->company();
|
||||
|
||||
return [
|
||||
'portal' => fake()->randomElement([Portal::Presseecho->value, Portal::Businessportal24->value]),
|
||||
'type' => fake()->randomElement(CompanyType::cases())->value,
|
||||
'name' => $name,
|
||||
'slug' => Str::slug($name).'-'.fake()->unique()->numberBetween(1000, 9999),
|
||||
'address' => fake()->streetAddress(),
|
||||
'country_code' => 'DE',
|
||||
'phone' => fake()->phoneNumber(),
|
||||
'email' => fake()->companyEmail(),
|
||||
'website' => fake()->url(),
|
||||
'is_active' => true,
|
||||
];
|
||||
}
|
||||
|
||||
public function presseecho(): static
|
||||
{
|
||||
return $this->state(['portal' => Portal::Presseecho->value]);
|
||||
}
|
||||
|
||||
public function businessportal24(): static
|
||||
{
|
||||
return $this->state(['portal' => Portal::Businessportal24->value]);
|
||||
}
|
||||
|
||||
public function inactive(): static
|
||||
{
|
||||
return $this->state(['is_active' => false]);
|
||||
}
|
||||
}
|
||||
30
database/factories/ContactFactory.php
Normal file
30
database/factories/ContactFactory.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Models\Company;
|
||||
use App\Models\Contact;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<Contact>
|
||||
*/
|
||||
class ContactFactory extends Factory
|
||||
{
|
||||
protected $model = Contact::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'company_id' => Company::factory(),
|
||||
'portal' => fake()->randomElement([Portal::Presseecho->value, Portal::Businessportal24->value]),
|
||||
'salutation_key' => fake()->randomElement(['mr', 'mrs', null]),
|
||||
'first_name' => fake()->firstName(),
|
||||
'last_name' => fake()->lastName(),
|
||||
'responsibility' => fake()->jobTitle(),
|
||||
'phone' => fake()->phoneNumber(),
|
||||
'email' => fake()->email(),
|
||||
];
|
||||
}
|
||||
}
|
||||
42
database/factories/FooterCodeFactory.php
Normal file
42
database/factories/FooterCodeFactory.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Models\FooterCode;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<FooterCode>
|
||||
*/
|
||||
class FooterCodeFactory extends Factory
|
||||
{
|
||||
protected $model = FooterCode::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'portal' => fake()->randomElement([
|
||||
Portal::Both->value,
|
||||
Portal::Presseecho->value,
|
||||
Portal::Businessportal24->value,
|
||||
]),
|
||||
'language' => fake()->randomElement([null, 'de', 'en']),
|
||||
'title' => fake()->sentence(3),
|
||||
'content' => fake()->paragraph(),
|
||||
'is_global' => false,
|
||||
'is_active' => true,
|
||||
'priority' => fake()->numberBetween(0, 100),
|
||||
];
|
||||
}
|
||||
|
||||
public function global(): static
|
||||
{
|
||||
return $this->state(['is_global' => true]);
|
||||
}
|
||||
|
||||
public function inactive(): static
|
||||
{
|
||||
return $this->state(['is_active' => false]);
|
||||
}
|
||||
}
|
||||
31
database/factories/InvoiceBillingAddressFactory.php
Normal file
31
database/factories/InvoiceBillingAddressFactory.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\InvoiceBillingAddress;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<InvoiceBillingAddress>
|
||||
*/
|
||||
class InvoiceBillingAddressFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'salutation_key' => fake()->randomElement(['mr', 'mrs', 'diverse']),
|
||||
'title' => fake()->optional()->randomElement(['Dr.', 'Prof.']),
|
||||
'name' => fake()->company(),
|
||||
'address1' => fake()->streetAddress(),
|
||||
'address2' => fake()->optional()->secondaryAddress(),
|
||||
'postal_code' => fake()->postcode(),
|
||||
'city' => fake()->city(),
|
||||
'country_code' => 'DE',
|
||||
];
|
||||
}
|
||||
}
|
||||
45
database/factories/InvoiceFactory.php
Normal file
45
database/factories/InvoiceFactory.php
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\InvoiceStatus;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\InvoiceBillingAddress;
|
||||
use App\Models\User;
|
||||
use App\Models\UserPayment;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<Invoice>
|
||||
*/
|
||||
class InvoiceFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$amount = fake()->numberBetween(1000, 20000);
|
||||
$tax = (int) round($amount * 0.19);
|
||||
|
||||
return [
|
||||
'user_id' => User::factory(),
|
||||
'user_payment_id' => UserPayment::factory(),
|
||||
'invoice_billing_address_id' => InvoiceBillingAddress::factory(),
|
||||
'number' => now()->format('Ym').'-'.fake()->unique()->numerify('####'),
|
||||
'status' => fake()->randomElement(InvoiceStatus::cases())->value,
|
||||
'amount_cents' => $amount,
|
||||
'tax_cents' => $tax,
|
||||
'total_cents' => $amount + $tax,
|
||||
'currency' => 'EUR',
|
||||
'is_netto' => false,
|
||||
'invoice_date' => now()->toDateString(),
|
||||
'due_date' => now()->addDays(14)->toDateString(),
|
||||
'paid_at' => null,
|
||||
'stripe_invoice_id' => fake()->optional()->regexify('in_[A-Za-z0-9]{14}'),
|
||||
'pdf_path' => null,
|
||||
];
|
||||
}
|
||||
}
|
||||
37
database/factories/PaymentOptionFactory.php
Normal file
37
database/factories/PaymentOptionFactory.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\PaymentOptionType;
|
||||
use App\Models\PaymentOption;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<PaymentOption>
|
||||
*/
|
||||
class PaymentOptionFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$type = fake()->randomElement(PaymentOptionType::cases())->value;
|
||||
$interval = $type === PaymentOptionType::Onetime->value
|
||||
? 'once'
|
||||
: fake()->randomElement(['monthly', 'yearly']);
|
||||
|
||||
return [
|
||||
'article_number' => 'ART-'.fake()->unique()->numerify('#####'),
|
||||
'type' => $type,
|
||||
'price_cents' => fake()->numberBetween(990, 49900),
|
||||
'currency' => 'EUR',
|
||||
'interval' => $interval,
|
||||
'is_hidden' => false,
|
||||
'stripe_product_id' => 'prod_'.fake()->regexify('[A-Za-z0-9]{14}'),
|
||||
'stripe_price_id' => 'price_'.fake()->regexify('[A-Za-z0-9]{14}'),
|
||||
];
|
||||
}
|
||||
}
|
||||
28
database/factories/PaymentOptionTranslationFactory.php
Normal file
28
database/factories/PaymentOptionTranslationFactory.php
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\PaymentOption;
|
||||
use App\Models\PaymentOptionTranslation;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<PaymentOptionTranslation>
|
||||
*/
|
||||
class PaymentOptionTranslationFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'payment_option_id' => PaymentOption::factory(),
|
||||
'locale' => fake()->randomElement(['de', 'en']),
|
||||
'name' => fake()->words(3, true),
|
||||
'description' => fake()->sentence(),
|
||||
];
|
||||
}
|
||||
}
|
||||
58
database/factories/PressReleaseFactory.php
Normal file
58
database/factories/PressReleaseFactory.php
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Enums\PressReleaseStatus;
|
||||
use App\Models\Category;
|
||||
use App\Models\Company;
|
||||
use App\Models\PressRelease;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends Factory<PressRelease>
|
||||
*/
|
||||
class PressReleaseFactory extends Factory
|
||||
{
|
||||
protected $model = PressRelease::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$title = fake()->sentence(6);
|
||||
|
||||
return [
|
||||
'uuid' => (string) Str::uuid(),
|
||||
'portal' => fake()->randomElement([Portal::Presseecho->value, Portal::Businessportal24->value]),
|
||||
'user_id' => User::factory(),
|
||||
'company_id' => Company::factory(),
|
||||
'category_id' => Category::factory(),
|
||||
'language' => 'de',
|
||||
'title' => $title,
|
||||
'slug' => Str::slug($title).'-'.fake()->unique()->numberBetween(1000, 9999),
|
||||
'text' => fake()->paragraphs(3, true),
|
||||
'status' => PressReleaseStatus::Draft->value,
|
||||
'hits' => 0,
|
||||
'no_export' => false,
|
||||
];
|
||||
}
|
||||
|
||||
public function published(): static
|
||||
{
|
||||
return $this->state([
|
||||
'status' => PressReleaseStatus::Published->value,
|
||||
'published_at' => now(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function inReview(): static
|
||||
{
|
||||
return $this->state(['status' => PressReleaseStatus::Review->value]);
|
||||
}
|
||||
|
||||
public function forPortal(Portal $portal): static
|
||||
{
|
||||
return $this->state(['portal' => $portal->value]);
|
||||
}
|
||||
}
|
||||
42
database/factories/ProfileFactory.php
Normal file
42
database/factories/ProfileFactory.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Profile;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<Profile>
|
||||
*/
|
||||
class ProfileFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => User::factory(),
|
||||
'salutation_key' => fake()->randomElement(['mr', 'mrs', 'none']),
|
||||
'title' => fake()->optional()->title(),
|
||||
'first_name' => fake()->firstName(),
|
||||
'last_name' => fake()->lastName(),
|
||||
'phone' => fake()->optional()->phoneNumber(),
|
||||
'address' => fake()->optional()->streetAddress(),
|
||||
'country_code' => 'DE',
|
||||
'birthdate' => fake()->optional()->date(),
|
||||
'backlink_url' => fake()->optional()->url(),
|
||||
'show_stats' => fake()->boolean(),
|
||||
'validation_date' => fake()->optional()->dateTimeBetween('-5 years'),
|
||||
'contract_date' => fake()->optional()->dateTimeBetween('-10 years'),
|
||||
'validate_token' => fake()->optional()->regexify('[A-Za-z0-9]{17}'),
|
||||
'tax_id_number' => fake()->optional()->numerify('DE#########'),
|
||||
'tax_exempt' => false,
|
||||
'tax_exempt_reason' => null,
|
||||
'disable_footer_code' => false,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
@ -2,25 +2,20 @@
|
|||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\Portal;
|
||||
use App\Enums\RegistrationType;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\User>
|
||||
* @extends Factory<User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The current password being used by the factory.
|
||||
*/
|
||||
protected static ?string $password;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
|
|
@ -29,16 +24,30 @@ class UserFactory extends Factory
|
|||
'email_verified_at' => now(),
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'remember_token' => Str::random(10),
|
||||
// Felder aus expand_users_table_for_migration_2026 explizit setzen,
|
||||
// da DB-Defaults nicht automatisch in Model-Attribute übernommen werden.
|
||||
'portal' => Portal::Both->value,
|
||||
'registration_type' => RegistrationType::ExistingLegacy->value,
|
||||
'language' => 'de',
|
||||
'is_active' => true,
|
||||
'is_super_admin' => false,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
|
||||
public function inactive(): static
|
||||
{
|
||||
return $this->state(['is_active' => false]);
|
||||
}
|
||||
|
||||
public function superAdmin(): static
|
||||
{
|
||||
return $this->state(['is_super_admin' => true]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
31
database/factories/UserPaymentFactory.php
Normal file
31
database/factories/UserPaymentFactory.php
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\PaymentStatus;
|
||||
use App\Models\UserPayment;
|
||||
use App\Models\UserPaymentOption;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<UserPayment>
|
||||
*/
|
||||
class UserPaymentFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'user_payment_option_id' => UserPaymentOption::factory(),
|
||||
'amount_cents' => fake()->numberBetween(990, 19900),
|
||||
'currency' => 'EUR',
|
||||
'status' => fake()->randomElement(PaymentStatus::cases())->value,
|
||||
'stripe_charge_id' => fake()->optional()->regexify('ch_[A-Za-z0-9]{14}'),
|
||||
'stripe_invoice_id' => fake()->optional()->regexify('in_[A-Za-z0-9]{14}'),
|
||||
];
|
||||
}
|
||||
}
|
||||
37
database/factories/UserPaymentOptionFactory.php
Normal file
37
database/factories/UserPaymentOptionFactory.php
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\UserPaymentOptionStatus;
|
||||
use App\Models\PaymentOption;
|
||||
use App\Models\User;
|
||||
use App\Models\UserPaymentOption;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<UserPaymentOption>
|
||||
*/
|
||||
class UserPaymentOptionFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => User::factory(),
|
||||
'payment_option_id' => PaymentOption::factory(),
|
||||
'status' => fake()->randomElement(UserPaymentOptionStatus::cases())->value,
|
||||
'grandfathered_until' => fake()->optional()->dateTimeBetween('now', '+2 years'),
|
||||
'legacy_conditions' => fake()->boolean(25)
|
||||
? ['note' => fake()->sentence(), 'discount_percent' => fake()->numberBetween(5, 40)]
|
||||
: null,
|
||||
'current_period_start' => now()->startOfMonth(),
|
||||
'current_period_end' => now()->endOfMonth(),
|
||||
'stripe_subscription_id' => fake()->optional()->regexify('sub_[A-Za-z0-9]{14}'),
|
||||
'cancelled_at' => null,
|
||||
];
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue