insert($row); } catch (\Exception $e) { // setting already exists, just ignore it if ($e->getCode() === 23000) { continue; } } } } /** * Add an award from the migrations (for example, if you're adding an award module) * * @param array $award See \App\Models\Awardv * * @throws \Illuminate\Validation\ValidationException */ public function addAward(array $award) { $validator = Validator::make($award, \App\Models\Award::$rules); if ($validator->fails()) { throw new ValidationException($validator); } $awardModel = new \App\Models\Award($award); $awardModel->save(); } }