10-04-2026
This commit is contained in:
parent
4d6b4930b2
commit
4bb89aad8c
836 changed files with 52961 additions and 5950 deletions
59
database/factories/CmsArticleFactory.php
Normal file
59
database/factories/CmsArticleFactory.php
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\CmsArticle;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends Factory<CmsArticle>
|
||||
*/
|
||||
class CmsArticleFactory extends Factory
|
||||
{
|
||||
protected $model = CmsArticle::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$title = fake()->sentence(6);
|
||||
|
||||
return [
|
||||
'slug' => Str::slug($title).'-'.fake()->unique()->numberBetween(100, 999),
|
||||
'title' => $title,
|
||||
'subtitle' => fake()->sentence(12),
|
||||
'image' => 'b2in/magazin-'.fake()->numberBetween(1, 5).'.jpg',
|
||||
'category' => fake()->randomElement(['Dubai Investment', 'Rendite & Einrichtung', 'B2B & Partner', 'Einrichtung & Netzwerk']),
|
||||
'date_label' => fake()->date('F j, Y'),
|
||||
'read_time' => fake()->numberBetween(3, 10).' min read',
|
||||
'author' => [
|
||||
'name' => fake()->name(),
|
||||
'bio' => fake()->sentence(15),
|
||||
'avatar' => 'b2in/marcel-scheibe.jpg',
|
||||
],
|
||||
'content' => ['de' => [
|
||||
'intro' => fake()->paragraph(3),
|
||||
'sections' => [
|
||||
['title' => fake()->sentence(5), 'content' => fake()->paragraph(4)],
|
||||
['title' => fake()->sentence(5), 'content' => fake()->paragraph(4)],
|
||||
['title' => fake()->sentence(5), 'content' => fake()->paragraph(4)],
|
||||
],
|
||||
]],
|
||||
'is_published' => true,
|
||||
'order' => 0,
|
||||
];
|
||||
}
|
||||
|
||||
public function published(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'is_published' => true,
|
||||
]);
|
||||
}
|
||||
|
||||
public function unpublished(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'is_published' => false,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue