/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $tables = Table::all();
     $tableNoClients = collect([]);
     foreach ($tables as $table) {
         if (!count($table->clients()->whereNull('leavetime')->get())) {
             $tableNoClients->push($table);
         }
     }
     return view('clients')->with('tableNoClients', $tableNoClients);
 }
Example #2
0
 public function currentQue()
 {
     $result = [];
     $tables = Table::all();
     foreach ($tables as $table) {
         $currentGuest = Que::where('table_id', $table->id)->orderBy('the_time')->limit(1)->first();
         if (isset($currentGuest->guest_id)) {
             $guest = Guest::find($currentGuest->guest_id);
         } else {
             $guest = [];
         }
         $result[$table->id] = $guest;
     }
     return json_encode($result);
 }
 public function getTableStatus()
 {
     $tables = Table::all();
     foreach ($tables as $table) {
         //check if table has clients
         if (count($table->clients()->where('leavetime', null)->get())) {
             $table->hasClient = true;
             $client = $table->clients()->where('leavetime', null)->first();
             //check if client is waiting
             if (count($client->orders) > 0) {
                 $order = $client->orders()->where('endtime', '=', null)->first();
                 if ($order) {
                     $table->waiting = true;
                 } else {
                     $table->waiting = false;
                 }
             } else {
                 $table->waiting = false;
             }
         } else {
             $table->hasClient = false;
         }
     }
     return $tables->toJson();
 }
Example #4
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($id)
 {
     $tables = Table::all();
     return view('tables.index', compact(['id', 'tables']));
 }
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $tables = Table::all();
     return $tables;
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $tables = Table::all();
     return view('admin.cms.index')->withTables($tables);
 }