public static function getCheckOut() { if (Auth::check()) { foreach (Request::all() as $value) { $my_res = (int) $value; } foreach (\App\Models\Billing::showGuests() as $guest) { if ($guest->cispobytu == $my_res) { break; } } $date_from = strtotime($guest->Datum); $date_to = strtotime($guest->DatumDo); $datediff = $date_to - $date_from; $days = (int) floor($datediff / (60 * 60 * 24)); foreach (\App\Models\Billing::showRooms() as $room) { if ($guest->Pokoj == $room->CisPokoje) { $room_price = $room->CenaNoc; break; } } $to_check = (object) ['name' => $guest->Meno, 'from' => $guest->Datum, 'to' => $guest->DatumDo, 'nights' => $days, 'pay' => (int) $guest->Cena + $days * $room_price, 'room' => $guest->Pokoj]; return \View::make('billing.checkout')->with('title', 'Check Out')->with('previous', $my_res)->with('info', $to_check); } else { return Redirect::route('home')->with('message', 'You are not logged in!'); } }