ldc-volena/database/seeders/Development/TestimonialSeeder.php
Jérémy Munsch f3d79cf7a9
Bump with laravel base controller phpstan and phpcs
Still TODO picture sizes for seeders
2024-02-12 15:51:31 +01:00

39 lines
1.1 KiB
PHP

<?php
namespace Database\Seeders\Development;
use App\Enums\Testimonials\TypeEnum;
use App\Lib\Helpers\FileStorageHelper;
use App\Models\Testimonial;
use Illuminate\Database\Seeder;
/**
* FIXME: Definir les tailes d'images pour les testimonials
*
* @package Database\Seeders\Development
*/
class TestimonialSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
FileStorageHelper::removeModelFiles(new Testimonial());
foreach (TypeEnum::cases() as $type) {
// @phpstan-ignore-next-line
Testimonial::factory(3)->make()->each(function (Testimonial $testimonial) use ($type) {
$testimonial->type = $type;
$testimonial->picture = FileStorageHelper::storeFile(
new Testimonial(),
new \SplFileInfo(\resource_path(
'../database/factories/assets/testimonials/default-picture-100x100.png'
))
);
$testimonial->save();
});
}
}
}