2021-12-07 23:35:14 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Database\Factories;
|
|
|
|
|
|
2022-01-21 14:26:44 +01:00
|
|
|
use App\Lib\Utils;
|
2021-12-07 23:35:14 +01:00
|
|
|
use App\Models\Slide;
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
|
use Illuminate\Support\Carbon;
|
|
|
|
|
use SplFileInfo;
|
|
|
|
|
|
|
|
|
|
class SlideFactory extends Factory
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* The name of the factory's corresponding model.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
2026-10-27 09:12:51 +01:00
|
|
|
#[\Override]
|
2021-12-07 23:35:14 +01:00
|
|
|
protected $model = Slide::class;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Define the model's default state.
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function definition()
|
|
|
|
|
{
|
2022-01-21 14:26:44 +01:00
|
|
|
|
2022-08-11 12:34:27 +02:00
|
|
|
$upload = new SplFileInfo(resource_path('assets/images/image-sample.jpg'));
|
|
|
|
|
$slide = new Slide();
|
2022-01-21 14:26:44 +01:00
|
|
|
$imgpath = Utils::storeImage($upload, $slide->getTable());
|
|
|
|
|
|
2021-12-07 23:35:14 +01:00
|
|
|
return [
|
|
|
|
|
'title' => $this->faker->unique()->word(),
|
|
|
|
|
'text' => $this->faker->realText(25),
|
|
|
|
|
'link_label' => $this->faker->text(128),
|
2024-03-29 12:27:37 +01:00
|
|
|
'link' => 'route(\'wasup\')',
|
2026-10-27 09:12:51 +01:00
|
|
|
'link_new_tab' => random_int(0, 1),
|
|
|
|
|
'date_start' => \Illuminate\Support\Facades\Date::now(),
|
|
|
|
|
'date_end' => \Illuminate\Support\Facades\Date::now()->addDays(2),
|
2022-01-21 14:26:44 +01:00
|
|
|
'picture' => $imgpath,
|
2021-12-17 17:27:25 +01:00
|
|
|
'alt_text_picture' => $this->faker->sentence(10),
|
2021-12-07 23:35:14 +01:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|