/**
  * Update the specified CalendarEvent in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $calendarevent = CalendarEvent::findOrFail($id);
     $validator = Validator::make($data = Input::all(), CalendarEvent::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $calendarevent->update($data);
     return Redirect::route('calendarevents.index');
 }
 /**
  * Remove the specified calendarevent from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $event = CalendarEvent::findOrFail($id);
     $event->delete();
     if (Request::wantsJson()) {
         return Response::json(array('Status' => 'Request Succeeded'));
     } else {
         Session::flash('successMessage', 'This event has been successfully deleted.');
         return Redirect::action('CalendarEventsController@index');
     }
 }
 /**
  * Update the specified resource in storage.
  * PUT /calendarevents/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function update($id)
 {
     $event = CalendarEvent::findOrFail($id);
     $location = Location::findOrFail($event->location_id);
     if (!$event) {
         Log::info('Attempt to edit a non-event!');
         if ($event->user_id != Auth::id()) {
             Log::info('Attempt to edit event of different Owner');
         }
         App::abort(404);
     }
     return $this->validateAndSave($event, $location);
 }