public function sheet($leadership_event_id, $activity_id)
 {
     $event = LeadershipEvent::findOrFail($leadership_event_id);
     $activity = Activity::findOrFail($activity_id);
     $this->layout->with('subtitle', $event->name());
     $this->layout->content = View::make('signup.sheet')->with('event', $event)->with('activity', $activity);
 }
 public function store($leadership_event_id)
 {
     $event = LeadershipEvent::findOrFail($leadership_event_id);
     $input = Input::all();
     $validator = Validator::make($input, Activity::$rules, Activity::$messages);
     if ($validator->passes()) {
         $activity = new Activity($input);
         $event->activities()->save($activity);
         return Redirect::route('activity.index', array($leadership_event_id));
     }
     return Redirect::route('activity.create', array($leadership_event_id))->withInput()->withErrors($validator);
 }
 public function store($leadership_event_id)
 {
     $event = LeadershipEvent::findOrFail($leadership_event_id);
     $input = Input::all();
     $validator = Validator::make($input, Booking::$rules, Booking::$messages);
     if ($validator->passes()) {
         $booking = new Booking($input);
         $event->bookings()->save($booking);
         return Redirect::route('booking.index', array($leadership_event_id));
     }
     return Redirect::route('booking.create', array($leadership_event_id))->withInput()->withErrors($validator);
 }
 public function search($leadership_event_id)
 {
     $name = Input::get('name');
     if (empty($name)) {
         return Redirect::route('registration', array($leadership_event_id))->with('message', 'You must provide a name');
     }
     $event = LeadershipEvent::findOrFail($leadership_event_id);
     $bookings = $event->bookings()->where(function ($query) use($name) {
         $query->where('bookings.first', 'LIKE', "%{$name}%")->orWhere('bookings.last', 'LIKE', "%{$name}%");
     })->get();
     $booking_count = $bookings->count();
     if ($booking_count == 0) {
         return Redirect::route('registration', array($leadership_event_id))->withInput()->with('message', 'No bookings found!');
     } else {
         $this->layout->with('subtitle', $event->name());
         $this->layout->content = View::make('registration.index')->with('event', $event)->with('bookings', $bookings);
     }
 }
 public function open($id)
 {
     $event = LeadershipEvent::findOrFail($id);
     $event->closed = false;
     $event->save();
     return Redirect::route('event.show', $id)->with('info', 'This event has been reopened');
 }