2021-12-15 18:17:17 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Database\Factories;
|
|
|
|
|
|
2022-01-23 15:13:17 +01:00
|
|
|
use App\Lib\Utils;
|
2021-12-15 18:17:17 +01:00
|
|
|
use App\Models\Advice;
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
|
use SplFileInfo;
|
|
|
|
|
|
|
|
|
|
class AdviceFactory extends Factory
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* The name of the factory's corresponding model.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
2026-10-27 09:12:51 +01:00
|
|
|
#[\Override]
|
2021-12-15 18:17:17 +01:00
|
|
|
protected $model = Advice::class;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Define the model's default state.
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function definition()
|
|
|
|
|
{
|
2022-01-23 15:13:17 +01:00
|
|
|
|
2022-08-11 12:34:27 +02:00
|
|
|
$upload = new SplFileInfo(resource_path('assets/images/repas.jpg'));
|
|
|
|
|
$advice = new Advice();
|
2022-01-23 15:13:17 +01:00
|
|
|
$imgpath = Utils::storeImage($upload, $advice->getTable());
|
|
|
|
|
|
2021-12-15 18:17:17 +01:00
|
|
|
return [
|
2021-12-17 17:27:25 +01:00
|
|
|
'title1' => $this->faker->text(40),
|
|
|
|
|
'title2' => $this->faker->text(40),
|
2022-01-23 15:13:17 +01:00
|
|
|
'picture1' => $imgpath,
|
2021-12-20 14:02:37 +01:00
|
|
|
'alt_text_picture1' => $this->faker->sentence(10),
|
2022-01-23 15:13:17 +01:00
|
|
|
'picture2' => $imgpath,
|
2021-12-20 14:02:37 +01:00
|
|
|
'alt_text_picture2' => $this->faker->sentence(10),
|
2022-01-23 15:13:17 +01:00
|
|
|
'picture3' => $imgpath,
|
2021-12-20 14:02:37 +01:00
|
|
|
'alt_text_picture3' => $this->faker->sentence(10),
|
2021-12-15 18:17:17 +01:00
|
|
|
'text1' => $this->faker->paragraph(10),
|
|
|
|
|
'text2' => $this->faker->paragraph(10),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|