ldc-loue/database/factories/RangeFactory.php
Jérémy Munsch aadb5c0acc Sprint2
2022-07-18 08:24:42 +00:00

43 lines
1.3 KiB
PHP

<?php
namespace Database\Factories;
use App\Enums\Ranges\RangeCategoryEnum;
use App\Models\Range;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class RangeFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Range::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$title = $this->faker->unique()->words(rand(6, 12), true);
return [
'title' => $title,
'slug' => Str::slug($title),
'seo_title' => $this->faker->words(8, true),
'seo_description' => $this->faker->words(25, true),
'description' => $this->faker->words(25, true),
'category' => collect(RangeCategoryEnum::toArray())->random(1)->get(0),
'picture' => '/assets/images/ranges/range_fake_700_700.jpg',
'picture_title' => $this->faker->words(8, true),
'picture_alt' => $this->faker->words(8, true),
'picture_thumb' => '/assets/images/ranges/range_fake_thumb_300_300.jpg',
'picture_thumb_title' => $this->faker->words(8, true),
'picture_thumb_alt' => $this->faker->words(8, true),
'status' => $this->faker->boolean(75),
];
}
}