| 12345678910111213141516171819202122232425262728 |
- <?php
- namespace Database\Factories;
- use Illuminate\Database\Eloquent\Factories\Factory;
- use App\Models\User;
- /**
- * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Blog>
- */
- class BlogFactory extends Factory
- {
- /**
- * Define the model's default state.
- *
- * @return array<string, mixed>
- */
- public function definition()
- {
- return [
- 'title' => $this->faker->realText($maxNbChars = 20, $indexSize = 2),
- 'content' => $this->faker->realText($maxNbChars = 200, $indexSize = 2),
- 'tags' => json_encode(['Gaming', 'Video', 'Fashion']),
- 'authorId' => $this->faker->randomElement(User::query()->get('id')),
- 'bookmarked' => rand(0,10000),
- ];
- }
- }
|