ldc-doux/database/factories/PictoBrandFactory.php
2022-08-11 12:34:27 +02:00

38 lines
894 B
PHP

<?php
namespace Database\Factories;
use App\Lib\Utils;
use App\Models\PictoBrand;
use Illuminate\Database\Eloquent\Factories\Factory;
use SplFileInfo;
class PictoBrandFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = PictoBrand::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
$upload = new SplFileInfo(resource_path('assets/images/site-production.jpg'));
$encart = new PictoBrand();
$imgpath = Utils::storeImage($upload, $encart->getTable());
return [
'title' => $this->faker->randomNumber(3, false),
'picture' => $imgpath,
'alt_text_picture' => $this->faker->sentence(10),
'text' => $this->faker->text(20),
];
}
}