Notifications
Clear all
BugOverflow
1
Posty
1
Users
0
Reactions
637
Widok
0
13/01/2022 10:56 pm
Topic starter
an simple seeder example
1 Answer
0
13/01/2022 10:58 pm
Topic starter
<?php namespace Database\Seeders; use App\Models\MyModelType; use Illuminate\Database\Seeder; class MyModelTypeSeeder extends Seeder { public function run() { $data = array( ['id' => 1,'name' => 'example name 1'], ['id' => 100,'name' => 'example name 2'], ['id' => 3,'name' => 'example name 3'], ); foreach ($data as $item) { try { MyModelType::create($item); } catch (\Exception $e){ dd($e); } } } }