public function airports() { \Excel::load('airport_list_2.xlsx', function ($reader) { $results = $reader->all()->toArray(); echo '<pre>'; print_r($results); echo '</pre>'; foreach ($results as $row) { $airport = new Airport(); $airport->country_code = $row['country_code']; $airport->city_code = $row['city_code']; $airport->airport_code = $row['airport_code']; $airport->state_code = $row['state_code']; $airport->airport_name = $row['airport_name']; $airport->airport_name_in_hr_hr = $row['airport_name_in_hr_hr']; $airport->airport_name_in_cs_cz = $row['airport_name_in_cs_cz']; $airport->airport_name_in_nl_be = $row['airport_name_in_nl_be']; $airport->airport_name_in_en_gb = $row['airport_name_in_en_gb']; $airport->airport_name_in_fr_fr = $row['airport_name_in_fr_fr']; $airport->airport_name_in_it_it = $row['airport_name_in_it_it']; $airport->airport_name_in_kk_kz = $row['airport_name_in_kk_kz']; $airport->airport_name_in_pl_pl = $row['airport_name_in_pl_pl']; $airport->airport_name_in_pt_pt = $row['airport_name_in_pt_pt']; $airport->airport_name_in_ro_ro = $row['airport_name_in_ro_ro']; $airport->airport_name_in_ru_ru = $row['airport_name_in_ru_ru']; $airport->airport_name_in_sk_sk = $row['airport_name_in_sk_sk']; $airport->airport_name_in_es_es = $row['airport_name_in_es_es']; $airport->airport_name_in_tr_tr = $row['airport_name_in_tr_tr']; $airport->active = $row['active']; $airport->save(); } }); }
/** * Создаем группы */ public function run() { Airport::create(array('airport' => 'Аэропорт «Домодедово»')); Airport::create(array('airport' => 'Аэропорт «Внуково»')); Airport::create(array('airport' => 'Аэропорт «Шереметьево 1»')); Airport::create(array('airport' => 'Аэропорт «Шереметьево 2»')); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $branche = new Station(); $branche->user_id = Auth::user()->id; $branche->airport_id = $request->airport; if ($branche->save()) { return response()->json(['success' => true, 'airport' => Airport::find($request->airport)]); } }
/** * 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)); } }
public function getDistance($airport1_id = Null, $airport2_id = Null) { $airport1 = Airport::find($airport1_id); $airport2 = Airport::find($airport2_id); if ($airport1 and $airport2) { $y1 = $airport1->lon; $y2 = $airport2->lon; $x1 = $airport1->lat; $x2 = $airport2->lat; $distance = acos(sin($x1 = deg2rad($x1)) * sin($x2 = deg2rad($x2)) + cos($x1) * cos($x2) * cos(deg2rad($y2) - deg2rad($y1))) * 6378.137; $distance = (int) $distance; return $distance; } }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit(Roomtype $roomtype) { $airports = Airport::lists('name', 'id'); return view('roomtype.edit', compact('roomtype', 'airports')); }
/** * Окно редактирования заказа */ public function getEditOrder($order_id = null) { $this->data['order'] = Order::where('ident', '=', $order_id)->firstOrFail(); $this->data['person'] = Person::findOrFail($this->data['order']->customer); $this->page->title = $this->data['person']->last_name . ' ' . $this->data['person']->first_name . ' ' . $this->data['person']->middle_name; $this->page->desc = 'Редактирование заказа'; // Список операторов $this->data['operators'] = Operator::where('user_id', '=', $this->user->id)->lists('name', 'id'); // Список аэропортов $this->data['airports'] = Airport::all()->lists('airport', 'id'); // Кол-во пассажиров $this->data['passengers'] = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 10); return $this->render('order.edit'); }
private function createAirport(Request $request) { $airport = Airport::create($request->all()); return $airport; }
public function get_airport_list(Request $request) { $result = array(); $airport_like = $request->get('term'); $airport_list = Airport::where('airport_name', 'LIKE', '%' . $airport_like . '%')->get(); foreach ($airport_list as $data) { $result[] = array('value' => $data->airport_name, 'airport_name' => $data->airport_name, 'airport_code' => $data->airport_code, 'city_code' => $data->city_code, 'country_code' => $data->airport_code); } echo json_encode($result); flush(); }
* Get the data to broadcast. * * @return array */ public function broadcastWith() { return ['user' => $this->user->id]; } } get('/broadcast', function () { echo \Illuminate\Support\Facades\Hash::make('b1e2r3n4i5'); event(new TestEvent(Auth::user())); //return view('welcome'); }); Route::post('airportajax', function (\Illuminate\Http\Request $request) { return \App\Airport::limit(10)->select(['id', 'name'])->search($request->name)->orderBy('name')->get(); }); Route::post('test', function (\Illuminate\Http\Request $request) { dd($request->all()); }); // Authentication routes... Route::get('login', 'Auth\\AuthController@getLogin'); Route::post('login', 'Auth\\AuthController@postLogin'); Route::get('logout', 'Auth\\AuthController@getLogout'); // Registration routes... Route::get('register', 'Auth\\AuthController@getRegister'); Route::post('register', 'Auth\\AuthController@postRegister'); Route::get('admin', function () { return view('admin_template'); }); Route::group(['middleware' => 'auth'], function () {
public function flight() { $s['airport'] = \App\Airport::all(); return view('reservasi.flight')->with($s); }
/** * update individual airport * @param $slug * @return * */ public function update(Airport $airport, Request $request) { // $airport = $this->airport->whereSlug($slug)->first(); $airport->fill($request->input())->save(); return redirect('/'); }
public function destroy(Airport $airport) { $airport->delete(); \Session::flash('flash_message', 'Success! Airport deleted'); return redirect('airports'); }