public function chooseCruise($id) { $cabins = DB::table('cruise_cabin')->join('cruise', 'cruise_cabin.cruise_id', '=', 'cruise.cruise_id')->join('cruise_package', 'cruise_package.cruise_id', '=', 'cruise.cruise_id')->where('cruise_package.id', $id)->select('cruise_cabin.id', 'cruise_cabin.cruise_cabin', 'cruise_cabin.cabinClass_id', 'cruise_cabin.cruise_id')->get(); $reservations = App\reservation::where('package_id', $id)->get(); $classes = App\cabinclass::all(); $data = array("package_id" => $id, "cabins" => $cabins, "classes" => $classes, "reservations" => $reservations); AIServer::trackEvent('passenger choose cabin'); AIServer::flush(); return view('book.Cabin', $data); // return ($reservations); }
/** * 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]); } } } }