2021-12-17 17:27:25 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Database\Factories;
|
|
|
|
|
|
2022-01-23 15:25:17 +01:00
|
|
|
use App\Lib\Utils;
|
|
|
|
|
use App\Models\Post;
|
2021-12-17 17:27:25 +01:00
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
|
use Illuminate\Support\Carbon;
|
|
|
|
|
use SplFileInfo;
|
|
|
|
|
|
|
|
|
|
class PostFactory extends Factory
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Define the model's default state.
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function definition()
|
|
|
|
|
{
|
2022-01-23 15:25:17 +01:00
|
|
|
|
2022-08-11 12:34:27 +02:00
|
|
|
$upload = new SplFileInfo(resource_path('assets/images/burger-fond.jpg'));
|
|
|
|
|
$picture = new Post();
|
2022-01-23 15:25:17 +01:00
|
|
|
$imghomepath = Utils::storeImage($upload, $picture->getTable());
|
2022-08-11 12:34:27 +02:00
|
|
|
$upload = new SplFileInfo(resource_path('assets/images/burger.jpg'));
|
2022-01-23 15:25:17 +01:00
|
|
|
$imgnewspath = Utils::storeImage($upload, $picture->getTable());
|
|
|
|
|
|
2021-12-17 17:27:25 +01:00
|
|
|
return [
|
|
|
|
|
'title' => $this->faker->text(5),
|
|
|
|
|
'text' => $this->faker->paragraph(10, false),
|
2022-01-23 15:25:17 +01:00
|
|
|
'picture_home' => $imghomepath,
|
2021-12-20 14:02:37 +01:00
|
|
|
'alt_text_picture_home' => $this->faker->sentence(10),
|
2022-01-23 15:25:17 +01:00
|
|
|
'picture_news' => $imgnewspath,
|
2021-12-20 14:02:37 +01:00
|
|
|
'alt_text_picture_news' => $this->faker->sentence(10),
|
2026-10-27 09:12:51 +01:00
|
|
|
'date_start' => \Illuminate\Support\Facades\Date::now(),
|
|
|
|
|
'date_end' => \Illuminate\Support\Facades\Date::now()->addDays(2),
|
2021-12-22 17:32:05 +01:00
|
|
|
'on_top' => true
|
2021-12-17 17:27:25 +01:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|