30 lines
830 B
PHP
30 lines
830 B
PHP
<?php
|
|
|
|
namespace Database\Seeders\Development;
|
|
|
|
use App\Enums\ExpertiseProducts\ExpertiseProductPageEnum;
|
|
use App\Models\ExpertiseProduct;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class ExpertiseProductSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
$exprtPageTypeEnumList = ExpertiseProductPageEnum::toArray();
|
|
|
|
foreach ($exprtPageTypeEnumList as $enum) {
|
|
ExpertiseProduct::factory(rand(0, 3))->make()->each(
|
|
// @phpstan-ignore-next-line
|
|
function (ExpertiseProduct $expertiseProduct) use ($enum) {
|
|
$expertiseProduct->page = ExpertiseProductPageEnum::make($enum->value);
|
|
$expertiseProduct->saveQuietly();
|
|
}
|
|
);
|
|
}
|
|
}
|
|
}
|