Exemplo n.º 1
0
 public function index()
 {
     $user_id = Auth::user()->id;
     $pre = PreReg::where('user_id', $user_id)->get();
     $ids = [];
     foreach ($pre as $p) {
         $ids[] = $p->room_id;
     }
     $rooms = [];
     if (count($ids) == 0) {
         $rooms = Room::online()->get();
     } else {
         $rooms = Room::online()->whereNotIn('id', $ids)->get();
     }
     return view('customer.index')->with(compact('rooms', 'pre'));
 }