public function view($id) { $package = App\cruise_package::where('id', $id)->first(); $cruises = App\cruise::all(); $data = array("package" => $package); AIServer::trackEvent('view cruise'); AIServer::flush(); return view('admin.AdminView', $data); }
/** * Run the database seeds. * * @return void */ public function run() { $cruises = cruise::all(); $cabinclasses = cabinclass::all(); // $cruise_cabin = new cruise_cabin; foreach ($cruises as $cruise) { foreach ($cabinclasses as $class) { for ($i = 1; $i <= 20; ++$i) { $cabin_name = $cruise->cruise_name . '-' . $class->cabinClass_id . sprintf('%03d', $i); DB::table('cruise_cabin')->insert(['cruise_cabin' => $cabin_name, 'cabinClass_id' => $class->cabinClass_id, 'cruise_id' => $cruise->cruise_id]); } } } }
public function setInfo() { $cruise = App\cruise::where('cruise_id', $_SESSION['cruise_select'])->first(); $stateroom = App\stateroom::where('stateroom_id', $_POST['stateroomOption'])->first(); $num_stateroom = $_POST['numStateroomOption']; $num_guest = $_POST['guestOption']; $total = $cruise->price + $stateroom->price * $num_stateroom + $num_guest * 100; $gst = round($total * 0.06, 2); $grand_total = $total + $gst; $data = array("cruise" => $cruise, "stateroom" => $stateroom, "num_stateroom" => $num_stateroom, "num_guest" => $num_guest, "total" => $total, "gst" => $gst, "grand_total" => $grand_total); $_SESSION['cruise'] = $cruise->cruise; $_SESSION['cruise_price'] = $cruise->price; $_SESSION['stateroom'] = $stateroom->stateroom; $_SESSION['stateroom_id'] = $stateroom->stateroom_id; $_SESSION['stateroom_price'] = $stateroom->price; $_SESSION['num_stateroom'] = $num_stateroom; $_SESSION['num_guest'] = $num_guest; $_SESSION['total'] = $total; $_SESSION['grand_total'] = $grand_total; return view('Book.payment', $data); }