Esempio n. 1
0
 /**
  * Show the application dashboard.
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function index()
 {
     $user = Auth::user();
     $events = collect();
     if ($user->personalDetails && $user->personalDetails->events) {
         $ids = $user->personalDetails->events->pluck('id');
         $events = Event::whereNotIn('id', $ids)->active()->latest()->limit(5)->get();
     } elseif (!$user->personalDetails || !$user->personalDetails->events) {
         $events = Event::active()->latest()->limit(5)->get();
     }
     $activeEvents = Event::active()->latest()->limit(5)->get();
     return view('home', compact('events', 'user', 'activeEvents'));
 }
Esempio n. 2
0
 /**
  * Events index page
  *
  * @return view
  **/
 public function index()
 {
     $events = Event::active();
     return view('dashboard.events.index', compact('events'));
 }