25 lines
569 B
PHP
25 lines
569 B
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\CommitmentPage;
|
|
use App\Models\Picto;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class CommitmentPageSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
CommitmentPage::factory(1)->createQuietly();
|
|
|
|
$pictos = Picto::query()->get();
|
|
CommitmentPage::query()->each(function (CommitmentPage $commitmentPage) use ($pictos) {
|
|
$commitmentPage->pictos()->saveManyQuietly($pictos->random(\rand(0, 2)));
|
|
});
|
|
}
|
|
}
|