55 lines
1.7 KiB
PHP
55 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\Sliders\SliderElementPosition;
|
|
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(),
|
|
'text_position_desktop' => Collect(SliderElementPosition::toArray())->random(),
|
|
'picture_position_mobile' => Collect(SliderElementPosition::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++
|
|
];
|
|
}
|
|
}
|