units as $unit){ \App\Unit::query()->firstOrCreate(["name"=>$unit],[ "name" => $unit, "code" => $unit ]); } } /** * Reverse the migrations. * * @return void */ public function down() { } }