29 lines
753 B
PHP
29 lines
753 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Post;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
class PostFactory extends Factory
|
|
{
|
|
protected $model = Post::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
$title = fake()->sentence();
|
|
|
|
return [
|
|
'title' => $title,
|
|
'description' => fake()->optional()->text(200),
|
|
'content' => fake()->paragraphs(5, true),
|
|
'slug' => Str::slug($title),
|
|
'image_path' => fake()->imageUrl(800, 600, 'posts'),
|
|
'image_thumbnail' => fake()->imageUrl(200, 200, 'posts'),
|
|
'image_alt' => fake()->sentence(),
|
|
'user_token' => fake()->uuid(),
|
|
];
|
|
}
|
|
}
|