44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Lib\Utils;
|
|
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
|
|
*/
|
|
protected $model = Advice::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function definition()
|
|
{
|
|
|
|
$upload = new SplFileInfo(resource_path('assets/images/repas.jpg'));
|
|
$advice = new Advice();
|
|
$imgpath = Utils::storeImage($upload, $advice->getTable());
|
|
|
|
return [
|
|
'title1' => $this->faker->text(40),
|
|
'title2' => $this->faker->text(40),
|
|
'picture1' => $imgpath,
|
|
'alt_text_picture1' => $this->faker->sentence(10),
|
|
'picture2' => $imgpath,
|
|
'alt_text_picture2' => $this->faker->sentence(10),
|
|
'picture3' => $imgpath,
|
|
'alt_text_picture3' => $this->faker->sentence(10),
|
|
'text1' => $this->faker->paragraph(10),
|
|
'text2' => $this->faker->paragraph(10),
|
|
];
|
|
}
|
|
}
|