public static function getOngoing() { $result = array(); foreach (Reservation::all() as $reservation) { if ($reservation->status == 1) { $result[] = $reservation; } } return $result; }
/** * Display a listing of the resource. * * @return Response */ public function index() { $reservations = $this->reservation->all(); return View::make('admin.reservations.index', compact('reservations')); }
public function check() { $day = Input::get('day'); $month = Input::get('month'); $year = Input::get('year'); $time = explode(':', Input::get('time')); $hour = $time[0]; $minute = $time[1]; $date = Carbon::create($year, $month, $day, $hour, $minute, 0); $reservations = Reservation::all(); $reservedTables = []; foreach ($reservations as $reservation) { if ($date->between($reservation->reservation_start, $reservation->reservation_start->addHours(3))) { $reservedTables[] = $reservation->table_id; } } return Response::json(['data' => $reservedTables]); }