예제 #1
0
파일: Event.php 프로젝트: Tchilly/Poolarna
 /**
  * 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;
 }
예제 #2
0
 /**
  * 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]);
 }