/**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $event = CalendarEvent::find($id);
     if (Auth::id() == $event->user_id) {
         $event = CalendarEvent::with('user')->where('id', '=', $id)->first();
         $categories = DB::table('churches')->lists('name', 'id');
         $ecategories = DB::table('categories')->lists('name', 'id');
         return View::make('events.edit')->with(array('event' => $event, 'categories' => $categories, 'ecategories' => $ecategories));
     } else {
         Session::flash('errorMessage', 'You can not edit a post that is not yours!');
         return Redirect::action('EventsController@index', $event->id);
     }
 }
 public function getManage()
 {
     if (!Auth::check()) {
         return Redirect::action('CalendarEventsController@index');
     } elseif (Auth::user()->role == 'admin') {
         $events = CalendarEvent::paginate(10);
         return View::make('calendarevents.manage')->with(array('events' => $events));
     } else {
         $query = CalendarEvent::with('user');
         $query->where('creator_id', Auth::user()->id);
         $events = $query->orderBy('created_at', 'DESC');
         return View::make('calendarevents.manage')->with(array('events' => $events));
     }
 }
 public function getEvent()
 {
     $events = CalendarEvent::with('location')->get();
     return Response::json($events);
 }
 public function getFeaturedEvent()
 {
     $featuredEvent = CalendarEvent::with('location')->where('featured_event', 'like', 'Landing')->first();
     $featuredEvent->startTime = $featuredEvent->start_time->format('m-d-y G:i');
     return Response::json($featuredEvent);
 }
 public function getList()
 {
     $query = CalendarEvent::with('user');
     $events = $query->get();
     return Response::json($events);
 }
<?php

/*
|-------------------------------------
| Route Bindings File
|-------------------------------------
*/
Route::bind('events', function ($value, $route) {
    return CalendarEvent::with('location', 'user')->findOrFail($value);
});
 public function getEvent()
 {
     $event = CalendarEvent::with('user')->get();
     return Response::json($event);
 }
 public function userEvents()
 {
     $events = CalendarEvent::with('user')->where('user_id', Auth::id())->get();
     if (!$events) {
         Session::flash('errorMessage', "No events for user found");
         App::abort(404);
     }
     return View::make('events.my_events')->with('events', $events);
 }