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)); } }
/** * Display a listing of the resource. * GET /location * * @return Response */ public function index() { $locations = Location::get(); $CalendarEvent = CalendarEvent::paginate(6); return View::make('/home')->with(array('locations' => $locations, 'events' => $CalendarEvent)); }