39 lines
928 B
PHP
39 lines
928 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Lib\Utils;
|
|
use App\Models\Encart;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use SplFileInfo;
|
|
|
|
class EncartFactory extends Factory
|
|
{
|
|
/**
|
|
* The name of the factory's corresponding model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $model = Encart::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function definition()
|
|
{
|
|
|
|
$upload = new SplFileInfo(resource_path('assets/images/prez-img.jpg'));
|
|
$encart = new Encart();
|
|
$imgpath = Utils::storeImage($upload, $encart->getTable());
|
|
|
|
return [
|
|
'title' => $this->faker->text(5),
|
|
'subtitle' => $this->faker->sentence(7, false),
|
|
'text' => $this->faker->paragraph(10, false),
|
|
'picture' => $imgpath,
|
|
'alt_text_picture' => $this->faker->sentence(10),
|
|
];
|
|
}
|
|
}
|