40 lines
1.2 KiB
PHP
40 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Enums\Concepts\ColorsEnum;
|
|
use App\Lib\Helpers\FileStorageHelper;
|
|
use App\Models\Concept;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class ConceptSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
$jj = 1;
|
|
Concept::factory(20)->make()->each(function (Concept $concept) use (&$jj) {
|
|
$concept->picture = FileStorageHelper::storeFile($concept, new \SplFileInfo(\resource_path(
|
|
'../database/factories/assets/concepts/default-picture-1512x354.png'
|
|
)));
|
|
$dataImg = FileStorageHelper::storeFile($concept, new \SplFileInfo(\resource_path(
|
|
'../database/factories/assets/concepts/default-picture-1140x795.png'
|
|
)));
|
|
$concept->data = $concept->getEmptyData(
|
|
fake()->words(2, true),
|
|
\collect(ColorsEnum::cases())->random()->value,
|
|
fake()->text(),
|
|
$dataImg,
|
|
fake()->words(4, true),
|
|
fake()->words(4, true)
|
|
);
|
|
$concept->order = $jj;
|
|
$concept->saveOrFail();
|
|
$jj = $jj + 1;
|
|
});
|
|
}
|
|
}
|