ldc-nature-and-respect/database/seeders/NewsSeeder.php
Jérémy Munsch c1369ea508
Implements #18 News.index
- Add toastify css to front
- Bump kwaadpepper/image-resizer with fit option
- Enhance news picture size to 770x770
2023-06-09 11:00:40 +02:00

35 lines
830 B
PHP

<?php
namespace Database\Seeders;
use App\Lib\Helpers\FileStorageHelper;
use App\Models\News;
use Illuminate\Database\Seeder;
class NewsSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$jj = 1;
News::factory(60)->make()->each(function (News $news) use (&$jj) {
$dataImg = FileStorageHelper::storeFile($news, new \SplFileInfo(\resource_path(
'../database/factories/assets/news/default-picture-770x770.jpg'
)));
$news->data = News::getEmptyData(
$dataImg,
fake()->words(4, true),
fake()->words(4, true)
);
$news->order = $jj;
$news->saveOrFail();
$jj = $jj + 1;
});
}
}