Esempio n. 1
0
 public function getAllBranches($table)
 {
     $branches = Branch::all();
     $tables_ids = [];
     $guests = [];
     $branches_ids = [];
     foreach ($branches as $branche) {
         if ($branche->position_id == 2) {
             $branches_ids[] = $branche->id;
         }
     }
     $tables = \DB::table('tables')->whereIn('branche_id', $branches_ids)->get();
     foreach ($tables as $tbl) {
         $tables_ids[] = $tbl->id;
     }
     $currentGuest = Que::whereIn('table_id', $tables_ids)->orderBy('the_time')->get();
     foreach ($currentGuest as $guest) {
         $guests[] = $guest->guest_id;
     }
     $items = Guest::whereIn('id', $guests)->where('status', '!=', 'token')->get();
     return view('distribution.distribution')->with(['items' => $items, 'branches' => $branches, 'branche' => Table::find($table)->branche_id, 'table' => $table]);
 }