コード例 #1
0
ファイル: DatabaseSeeder.php プロジェクト: pz6tnk/laravel-CRM
 /**
  * Создаем группы
  */
 public function run()
 {
     Airport::create(array('airport' => 'Аэропорт «Домодедово»'));
     Airport::create(array('airport' => 'Аэропорт «Внуково»'));
     Airport::create(array('airport' => 'Аэропорт «Шереметьево 1»'));
     Airport::create(array('airport' => 'Аэропорт «Шереметьево 2»'));
 }
コード例 #2
0
 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');
 }
コード例 #3
0
 /**
  * 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));
     }
 }
コード例 #4
0
 private function createAirport(Request $request)
 {
     $airport = Airport::create($request->all());
     return $airport;
 }