ldc-legaulois/database/seeders/Development/HistoricalMilestoneSeeder.php
2024-07-23 14:57:35 +02:00

29 lines
841 B
PHP

<?php
namespace Database\Seeders\Development;
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(): void
{
HistoricalMilestone::factory(20)->make()->each(function (HistoricalMilestone $historicalMilestone) {
$historicalMilestone->picture = FileStorageHelper::storeFile(
$historicalMilestone,
new \SplFileInfo(\resource_path(
'../database/factories/assets/historical_milestones/default-picture-608x342.png'
))
);
$historicalMilestone->picto = null;
$historicalMilestone->saveQuietly();
});
}
}