ldc-loue/database/factories/SliderFactory.php
Jérémy Munsch 0751114f4a
BO News, Tags, Sliders
CKeditor + word counter + Image Input + Taggable VUE3
Better Xss Sanitizer
Handle Video Youtube + Image Upload + Inline Image from url
Better Image Input component with reset, easizer resize
Full Responsive BO
2022-06-04 15:55:36 +02:00

54 lines
1.6 KiB
PHP

<?php
namespace Database\Factories;
use App\Enums\Sliders\SliderPosition;
use App\Enums\Sliders\SliderType;
use App\Models\Slider;
use Illuminate\Database\Eloquent\Factories\Factory;
class SliderFactory extends Factory
{
/**
* OrderCounter
*
* @var integer
*/
protected static $i = 1;
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Slider::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$title = $this->faker->unique()->words(rand(2, 4), true);
$subtitle = $this->faker->unique()->words(rand(8, 10), true);
return [
'type' => Collect(SliderType::toArray())->random(),
'position' => Collect(SliderPosition::toArray())->random(),
'title' => $title,
'title_color' => $this->faker->hexColor(),
'title_color_bg' => $this->faker->hexColor(),
'subtitle' => $subtitle,
'subtitle_color' => $this->faker->hexColor(),
'subtitle_color_bg' => $this->faker->hexColor(),
'picture' => '/assets/images/sliders/slider_fake_1400_630.jpg',
'link' => $this->faker->url,
'link_title' => $this->faker->unique()->words(rand(2, 4), true),
'link_color' => $this->faker->hexColor(),
'link_color_bg' => $this->faker->hexColor(),
'link_new_tab' => $this->faker->boolean,
'status' => $this->faker->boolean(75),
'order' => static::$i++
];
}
}