ldc-doux/database/factories/PictoFactory.php

38 lines
820 B
PHP
Raw Permalink Normal View History

2021-12-13 16:55:12 +01:00
<?php
namespace Database\Factories;
2022-01-23 12:31:21 +01:00
use App\Lib\Utils;
use App\Models\Picto;
2021-12-13 16:55:12 +01:00
use Illuminate\Database\Eloquent\Factories\Factory;
use SplFileInfo;
class PictoFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
2026-10-27 09:12:51 +01:00
#[\Override]
2021-12-13 16:55:12 +01:00
protected $model = Picto::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
2022-08-11 12:34:27 +02:00
$upload = new SplFileInfo(resource_path('assets/images/qualite.png'));
$picto = new Picto();
2022-01-23 12:31:21 +01:00
$imgpath = Utils::storeImage($upload, $picto->getTable());
2021-12-13 16:55:12 +01:00
return [
2022-01-23 12:31:21 +01:00
'picture' => $imgpath,
2021-12-20 14:02:37 +01:00
'alt_text_picture' => $this->faker->sentence(10),
2021-12-13 16:55:12 +01:00
'text' => $this->faker->text(10),
];
}
}