Init(Core): add project to git and add seeders and factory
This commit is contained in:
28
database/factories/PostFactory.php
Normal file
28
database/factories/PostFactory.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user