ldc-doux/database/factories/PictoBrandFactory.php

40 lines
911 B
PHP
Raw Permalink Normal View History

2021-12-13 16:55:12 +01:00
<?php
namespace Database\Factories;
2022-01-23 11:45:06 +01:00
use App\Lib\Utils;
2021-12-13 16:55:12 +01:00
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
*/
2026-10-27 09:12:51 +01:00
#[\Override]
2021-12-13 16:55:12 +01:00
protected $model = PictoBrand::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
2022-01-23 11:45:06 +01:00
2022-08-11 12:34:27 +02:00
$upload = new SplFileInfo(resource_path('assets/images/site-production.jpg'));
$encart = new PictoBrand();
2022-01-23 11:45:06 +01:00
$imgpath = Utils::storeImage($upload, $encart->getTable());
2021-12-13 16:55:12 +01:00
return [
'title' => $this->faker->randomNumber(3, false),
2022-01-23 11:45:06 +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(20),
];
}
}