ldc-doux/database/factories/EncartFactory.php

41 lines
945 B
PHP
Raw Permalink Normal View History

2021-12-08 17:32:56 +01:00
<?php
namespace Database\Factories;
use App\Lib\Utils;
2021-12-08 17:32:56 +01:00
use App\Models\Encart;
use Illuminate\Database\Eloquent\Factories\Factory;
2021-12-09 17:31:10 +01:00
use SplFileInfo;
2021-12-08 17:32:56 +01:00
class EncartFactory extends Factory
{
2021-12-09 17:31:10 +01:00
/**
* The name of the factory's corresponding model.
*
* @var string
*/
2026-10-27 09:12:51 +01:00
#[\Override]
2021-12-08 17:32:56 +01:00
protected $model = Encart::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/prez-img.jpg'));
$encart = new Encart();
$imgpath = Utils::storeImage($upload, $encart->getTable());
2021-12-08 17:32:56 +01:00
return [
2021-12-09 17:31:10 +01:00
'title' => $this->faker->text(5),
'subtitle' => $this->faker->sentence(7, false),
'text' => $this->faker->paragraph(10, false),
'picture' => $imgpath,
2021-12-20 14:02:37 +01:00
'alt_text_picture' => $this->faker->sentence(10),
2021-12-08 17:32:56 +01:00
];
}
}