48 lines
1.3 KiB
PHP
48 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Slide;
|
|
use DateInterval;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<Slide>
|
|
*/
|
|
class SlideFactory extends Factory
|
|
{
|
|
/**
|
|
* The name of the factory's corresponding model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $model = Slide::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$date_start = fake()->dateTimeBetween('-1 month', 'now');
|
|
$date_end = $date_start->add(DateInterval::createFromDateString('2days'));
|
|
|
|
return [
|
|
'title' => fake()->sentence(4),
|
|
'text' => fake()->paragraph(),
|
|
'link' => fake()->url(),
|
|
'link_label' => fake()->words(2, true),
|
|
'link_new_tab' => fake()->boolean(),
|
|
'connected' => fake()->boolean(20),
|
|
'picture' => fake()->imageUrl(1920, 1080, 'nature'),
|
|
'picture_alt' => fake()->sentence(3),
|
|
'picture_title' => fake()->sentence(3),
|
|
'status' => true,
|
|
'date_start' => $date_start,
|
|
'date_end' => $date_end,
|
|
];
|
|
}
|
|
}
|