ldc-doux/database/seeders/PictosSeeder.php

41 lines
976 B
PHP
Raw Permalink Normal View History

2021-12-13 16:55:12 +01:00
<?php
namespace Database\Seeders;
2021-12-15 10:09:39 +01:00
use App\Enums\Page;
2022-01-23 12:31:21 +01:00
use App\Lib\Utils;
2021-12-13 16:55:12 +01:00
use App\Models\Picto;
use Illuminate\Database\Seeder;
use SplFileInfo;
class PictosSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
2021-12-15 10:09:39 +01:00
$tabEncarts = [
Page::marqueBloc2(),
Page::foodBloc2()
];
2022-01-23 12:31:21 +01:00
$upload = new SplFileInfo(resource_path('assets/images/qualite.png'));
$picto = new Picto();
$imgpath = Utils::storeImage($upload, $picto->getTable());
2026-10-27 09:12:51 +01:00
foreach ($tabEncarts as $value) {
2021-12-13 16:55:12 +01:00
for ($i = 0; $i < 5; $i++) {
$picto = new Picto();
2021-12-15 10:09:39 +01:00
$picto->page = $value;
2022-01-23 12:31:21 +01:00
$picto->picture = $imgpath;
2021-12-20 14:02:37 +01:00
$picto->alt_text_picture = 'lorem ipsum set doloris at em gorbicus';
2021-12-13 16:55:12 +01:00
$picto->text = 'lorem ipsum set doloris';
$picto->save();
}
}
}
}