public function postUpdateeventhotel() { $s = Hotel::find(Input::get('id')); if ($s) { $s->eventname = Input::get('eventname'); $s->hotelname = Input::get('hotelname'); $s->details = Input::get('details'); $s->save(); return Redirect::to('hotelbooking/eventhotel')->with('message', 'Hotel Updated'); } return Redirect::to('hotelbooking/eventhotel')->with('message', 'Could not Update'); }
public function postAssociateChild($model, $child_relation, $child) { if ($child_relation == 'first_hotel_option' or $child_relation == 'second_hotel_option') { $child = Hotel::find($child); } if ($model->{$child_relation}()->find($child)) { return Response::json(['error' => 'Already attached', 'reload' => false]); } $model->{$child_relation}()->associate($child); $model->save(); return Response::json(['success' => 'success', 'reload' => true]); }
public function getSave() { $id = Input::get('id'); $hotel = Hotel::find($id); $hotel->name = Input::get('name'); $hotel->email = Input::get('email'); $hotel->phone = Input::get('phone'); $hotel->city_id = Input::get('city_id'); $hotel->address = Input::get('address'); $hotel->save(); Session::flash('message', 'The records are updated successfully'); return Redirect::to('hotel'); }
| | Here is where you can register all of the routes for an application. | It's a breeze. Simply tell Laravel the URIs it should respond to | and give it the Closure to execute when that URI is requested. | */ Route::get('registration/company', function () { return Response::JSON(['test' => Session::getToken()]); }); Route::get('/test', function () { $event_date = '2015-10-13'; $task = (object) ['deadline_days_gap' => -2]; $new_deadline = strtotime(-$task->deadline_days_gap . ' days', strtotime($event_date)); echo date('Y-m-d', $new_deadline); return; $hotel = Hotel::find(4); Debugbar::info($hotel); $venue = Venue::find(77); $hospitality = $venue->hospitality; Debugbar::info($hospitality); $first_hotel = $hospitality->first_hotel_option()->associate($hotel); $first_hotel = $hospitality->first_hotel_option()->get(); Debugbar::info($first_hotel); echo 'test'; }); Route::get('/table-view', function () { return View::make('test/table-view'); }); /** ------------------------------------------ * Route model binding * ------------------------------------------
/** * Remove the specified resource from storage. * * @param $post * @return Response */ public function postDelete($hotel) { // Declare the rules for the form validation $rules = array('id' => 'required|integer'); // Validate the inputs $validator = Validator::make(Input::all(), $rules); // Check if the form validates with success if ($validator->passes()) { $id = $hotel->id; $hotel->delete(); // Was the blog post deleted? $hotel = Hotel::find($id); if (empty($hotel)) { // Redirect to the blog posts management page return Redirect::to('admin/hotels')->with('success', Lang::get('admin/hotels/messages.delete.success')); } } // There was a problem deleting the blog post return Redirect::to('admin/hotels')->with('error', Lang::get('admin/hotels/messages.delete.error')); }
/** * Remove the specified hotel from storage. * * @param int $id * @return Response */ public function destroy($id) { $hotel = Hotel::find($id); $hotel->imagens()->delete(); $hotel->delete(); return Redirect::back()->with('success', array('Registro deletado.')); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $hotel = Hotel::find($id); $hotel->delete(); return Redirect::back(); }
/** * Show the form for editing the specified hotel. * * @param int $id * @return Response */ public function edit($id) { $hotel = Hotel::find($id); return View::make('hotels.edit', compact('hotel')); }