33 lines
1 KiB
PHP
33 lines
1 KiB
PHP
<?php
|
|
|
|
/** @var \Illuminate\Database\Eloquent\Factory $factory */
|
|
|
|
use App\Models\Actu;
|
|
use Faker\Generator as Faker;
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| Model Factories
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| This directory should contain each of the model factory definitions for
|
|
| your application. Factories provide a convenient way to generate new
|
|
| model instances for testing / seeding your application's database.
|
|
|
|
|
*/
|
|
|
|
$i = 1;
|
|
$factory->define(Actu::class, function (Faker $faker) use (&$i) {
|
|
$title = implode(' ', $faker->unique()->words(rand(6, 12)));
|
|
$front = ($i++ <= 3 ? true : false);
|
|
return [
|
|
'title' => $title,
|
|
'slug' => \Illuminate\Support\Str::slug($title),
|
|
'header' => $faker->text(300),
|
|
'content' => $faker->text(1500),
|
|
'picture' => '/assets/images/actu_fake_image.jpg',
|
|
'picture_alt' => 'Image de champs',
|
|
'front' => $front,
|
|
'status' => $front ?: (bool)rand(0, 1)
|
|
];
|
|
});
|