12-05-2026 Frontend dev
This commit is contained in:
parent
405df0a122
commit
5b8bdf4182
779 changed files with 480564 additions and 6241 deletions
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)],
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue