/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($slug) { $event = Event::findBySlug($slug); $chair_id = (int) \Request::get('chair_id'); if (\Auth::id() === $chair_id) { $result = $event->update(array('chair_id' => $chair_id)); } if ($result) { return response('Event chair updated!'); } else { abort(409, 'There was an issue updating the registration.'); } }
public function registrations($slug) { $event = Event::findBySlug($slug); // Check if exists if (!$event) { abort(404); } $registrations = $event->allRegistrations(); return view('pages.admin.events.registrations', compact('event', 'registrations')); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($slug, $id) { $event = Event::findBySlug($slug); if ($id == 'self') { if (\Auth::check()) { EventRegistration::where('user_id', '=', \Auth::id())->where('event_id', '=', $event->id)->delete(); } } else { EventRegistration::destroy($id); } }