ldc-agis/database/seeders/TestimonialSeeder.php
2023-10-24 15:15:55 +02:00

26 lines
709 B
PHP

<?php
namespace Database\Seeders;
use App\Lib\Helpers\FileStorageHelper;
use App\Models\Testimonial;
use Illuminate\Database\Seeder;
class TestimonialSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
FileStorageHelper::removeModelFiles(new Testimonial());
Testimonial::factory(12)->make()->each(function (Testimonial $testimonial) {
$testimonial->picture = FileStorageHelper::storeFile($testimonial, new \SplFileInfo(\resource_path(
'../database/factories/assets/testimonials/default-picture-292x417.png'
)));
$testimonial->saveOrFail();
});
}
}