/** * Getting the data from booking front end form * @param Json * @return void * */ public function bookingSubmitApi(Request $request) { $booking = new BookingsModel(); $booking->name = $request->get('name'); $booking->receive_place = $request->get('receive-place'); $booking->leaving_place = $request->get('leaving-place'); $booking->receive_date = $request->get('receive-date'); $booking->leaving_date = $request->get('leaving-date'); $booking->price_plan = $request->get('price-plan'); $booking->promotion_code = $request->get('promotion-code'); $booking->save(); return Redirect::to('/'); }
/** * Display a listing of the resource. * return the data for graph * @return \Illuminate\Http\Response */ public function index() { $carbon = Carbon::now(); $admin = AdminProfile::all()->last(); /*Cars Model On Service Graph*/ $carsLuxary = CarsModel::all()->where('status', '2')->where('class', '1')->count(); $carsMiddle = CarsModel::all()->where('status', '2')->where('class', '2')->count(); $carsComfort = CarsModel::all()->where('status', '2')->where('class', '3')->count(); /*Price Plan Most Popular*/ $pricePlan1 = BookingsModel::all()->where('price_plan', '1')->count(); $pricePlan2 = BookingsModel::all()->where('price_plan', '2')->count(); $pricePlan3 = BookingsModel::all()->where('price_plan', '3')->count(); /*Bookings Status*/ $completed = BookingsModel::all()->where('status', '1')->where('receive_date', $carbon->subMonth())->count(); $onGoing = BookingsModel::all()->where('status', '2')->where('receive_date', $carbon->subMonth())->count(); $upComing = BookingsModel::all()->where('status', '3')->where('receive_date', $carbon->subMonth())->count(); return view('partials/index', ['admin' => $admin, 'carsLuxary' => $carsLuxary, 'carsMiddle' => $carsMiddle, 'carsComfort' => $carsComfort, 'pricePlan1' => $pricePlan1, 'pricePlan2' => $pricePlan2, 'pricePlan3' => $pricePlan3, 'carbon' => $carbon, 'completed' => $completed, 'onGoing' => $onGoing, 'upComing' => $upComing]); }
/** * Getting all the bookings data listing * @return resource * */ public function allBookingsListing() { $bookings = BookingsModel::all(); return $bookings; }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { // Taking the model bind $booking = BookingsModel::find($id); //Getting ID and deleting it $booking->delete(); //Redirect Session::flash('message', 'Deleted The Booking data'); return Redirect::to('admin/bookings'); }