28 lines
766 B
PHP
28 lines
766 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, int $key) {
|
||
|
|
$testimonial->picture = FileStorageHelper::storeFile($testimonial, new \SplFileInfo(\resource_path(
|
||
|
|
'../database/factories/assets/testimonials/default-picture-292x417.png'
|
||
|
|
)));
|
||
|
|
$testimonial->order = $key + 1;
|
||
|
|
$testimonial->saveQuietly();
|
||
|
|
});
|
||
|
|
}
|
||
|
|
}
|