/** * Создаем группы */ public function run() { Airport::create(array('airport' => 'Аэропорт «Домодедово»')); Airport::create(array('airport' => 'Аэропорт «Внуково»')); Airport::create(array('airport' => 'Аэропорт «Шереметьево 1»')); Airport::create(array('airport' => 'Аэропорт «Шереметьево 2»')); }
public function store(CreateAirportRequest $request, Airport $airport) { $airport->create($request->all()); \Session::flash('flash_message', 'Success! Airport created'); return redirect('airports/' . $airport->slug); // return redirect()->route('airports_path'); }
/** * Run the database seeds. * * @return void */ public function run() { DB::table('airports')->delete(); $airportsJson = File::get(storage_path() . "/jsondata/airports.json"); $airports = json_decode($airportsJson); foreach ($airports as $airport) { Airport::create(array('name' => $airport->name, 'country' => $airport->iso, 'code' => $airport->iata)); } }
private function createAirport(Request $request) { $airport = Airport::create($request->all()); return $airport; }