/** * Display a listing of the resource. * * @return Response */ public function index() { /*CalendarEvent is the Class name in CalendarEvent model*/ $query = new CalendarEvent(); $search = Input::get('search'); if (Input::has('search')) { $query->where('title', 'like', '%' . $search . "%")->orWhere('description', 'like', '%' . $search . "%"); /* ->orWhereHas('tag', function($q) use ($name){ $q->where('name', 'like', '%' . $search . "%") }*/ /* ->orWhereHas('user', function($q) use ($search){ $q->where('first_name', 'like', '%' . $search . "%") ->orWhere('last_name', 'like', '%' . $search . "%"); });*/ } //display a listing of calendar events $calendar_events = $query->orderBy('start_date_time', 'desc')->paginate(10); $calendar_events = $query->get(); /*->orderBy('start_date_time', 'desc')->paginate(10) // dd($calendar_events); /* compact() is a PHP function. It creates an array containing variables and their values*/ return View::make('calendar_events.index', compact('calendar_events')); /*return View::make('calendar_events.index')->with('calendar_events', $calendar_events);*/ }
/** * Display a listing of the resource. * GET /location * * @return Response */ public function index() { $locations = Location::orderBy('created_at', 'desc')->paginate(6); $events = CalendarEvent::orderBy('created_at', 'desc')->paginate(6); return View::make('/home')->with(array('locations' => $locations, 'events' => $events)); }
/** * Display a listing of events * * @return Response */ public function index() { $events = CalendarEvent::orderBy('event_start', 'desc')->paginate(6); return View::make('events.index', compact('events')); }