/** * Check to see if user is signed up for event. */ public function checkAvailability($id = null) { if ($id == null) { $id = $this->id; } $event = Event::find($id); $availability = $event->availability; $signed = DB::table('participants')->select('user_id')->where('event_id', '=', $event->id)->count(); $availability = $availability - $signed; if ($availability <= 0) { return false; } return true; }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { // List an event $event = Event::find($id); return view('event.edit', ['event' => $event]); }