|
1 | 1 | <?php |
2 | 2 |
|
3 | | -namespace Database\Factories; |
| 3 | +namespace Javaabu\Cms\Database\Factories; |
4 | 4 |
|
5 | 5 | use Illuminate\Database\Eloquent\Factories\Factory; |
6 | 6 | use Illuminate\Support\Carbon; |
7 | 7 | use Javaabu\Cms\Models\Post; |
8 | 8 | use Javaabu\Cms\Models\PostType; |
9 | 9 | use Javaabu\Cms\Support\Faker\Factory\ContentBlockFactory; |
| 10 | +use Javaabu\Helpers\Enums\PublishStatuses; |
10 | 11 |
|
11 | 12 | class PostFactory extends ContentBlockFactory |
12 | 13 | { |
| 14 | + /** |
| 15 | + * The name of the factory's corresponding model. |
| 16 | + * |
| 17 | + * @var class-string<\Illuminate\Database\Eloquent\Model> |
| 18 | + */ |
13 | 19 | protected $model = Post::class; |
14 | 20 |
|
15 | 21 | public function definition(): array |
16 | 22 | { |
17 | 23 | return [ |
18 | | - 'title' => $this->faker->word(), |
19 | | - 'slug' => $this->faker->slug(), |
| 24 | + 'title' => fake()->words(2, true), |
| 25 | + 'slug' => fake()->slug(), |
20 | 26 | 'content' => $this->getContentBlock(), |
21 | | - 'excerpt' => $this->faker->word(), |
22 | | - 'menu_order' => $this->faker->randomNumber(), |
23 | | - 'status' => $this->faker->word(), |
24 | | - 'published_at' => Carbon::now(), |
25 | | - 'created_at' => Carbon::now(), |
26 | | - 'updated_at' => Carbon::now(), |
27 | | - 'document_no' => $this->faker->word(), |
28 | | - 'expire_at' => Carbon::now(), |
29 | | - 'format' => $this->faker->word(), |
30 | | - 'video_url' => $this->faker->url(), |
31 | | - 'page_style' => $this->faker->word(), |
32 | | - 'ref_no' => $this->faker->word(), |
33 | | - 'recently_updated' => $this->faker->boolean(), |
34 | | - 'coords' => $this->faker->word(), |
35 | | - 'city_id' => $this->faker->randomNumber(), |
36 | | - |
| 27 | + 'excerpt' => fake()->words(2, true), |
| 28 | + 'menu_order' => fake()->randomNumber(), |
| 29 | + 'status' => fake()->randomElement(PublishStatuses::cases()), |
| 30 | +// 'published_at' => Carbon::now(), |
| 31 | +// 'created_at' => Carbon::now(), |
| 32 | +// 'updated_at' => Carbon::now(), |
| 33 | +// 'document_no' => fake()->words(2, true), |
| 34 | +// 'expire_at' => Carbon::now(), |
| 35 | +// 'format' => fake()->words(2, true), |
| 36 | +// 'video_url' => fake()->url(), |
| 37 | +// 'page_style' => fake()->words(2, true), |
| 38 | +// 'ref_no' => fake()->words(2, true), |
| 39 | +// 'recently_updated' => fake()->boolean(), |
| 40 | +// 'coords' => fake()->words(2, true), |
| 41 | +// 'city_id' => fake()->randomNumber(), |
| 42 | +// |
37 | 43 | 'type' => random_id_or_generate(PostType::class, 'slug'), |
38 | 44 | ]; |
39 | 45 | } |
|
0 commit comments