🗃️ Ajouter un seeder de post pour tester
This commit is contained in:
16
database/factories/PostFactory.php
Normal file
16
database/factories/PostFactory.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
||||
|
||||
use App\Model;
|
||||
use Faker\Generator as Faker;
|
||||
|
||||
$factory->define(\App\Post::class, function (Faker $faker) {
|
||||
return [
|
||||
'user_id' => 1,
|
||||
'date_post' => $faker->dateTimeBetween('-1 year'),
|
||||
// 'date_post' => \Carbon\Carbon::createFromFormat('Y-n-d', rand(2018,2019), rand(1,12), rand(1,28)),
|
||||
'content' => $faker->sentences(3, true),
|
||||
'created_at' => \Carbon\Carbon::now()
|
||||
];
|
||||
});
|
Reference in New Issue
Block a user