29 lines
843 B
PHP
29 lines
843 B
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Lib\Helpers\FileStorageHelper;
|
|
use App\Models\HistoricalMilestone;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class HistoricalMilestoneSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
FileStorageHelper::removeModelFiles(new HistoricalMilestone());
|
|
HistoricalMilestone::factory(10)->make()->each(function (HistoricalMilestone $historicalMilestone) {
|
|
$historicalMilestone->picture = FileStorageHelper::storeFile(
|
|
new HistoricalMilestone(),
|
|
new \SplFileInfo(\resource_path(
|
|
'../database/factories/assets/historical_milestones/default-picture-100x100.png'
|
|
))
|
|
);
|
|
$historicalMilestone->save();
|
|
});
|
|
}
|
|
}
|