Ejemplo n.º 1
0
 public function reservation()
 {
     if (!Session::has('r_trip_id', 'r_passengers', 'r_data')) {
         return redirect()->route('welcome');
     }
     $trip = Trip::find(Session::get('r_trip_id'));
     $passengers = Session::get('r_passengers');
     $data = Session::get('r_data');
     return view('payment.reserved_page', ['passengers' => $passengers, 'trip' => $trip, 'data' => $data]);
 }
Ejemplo n.º 2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $id)
 {
     // create the new Order
     $trip = Trip::find($id);
     // Get the data
     $trip->range_id = $request->range_id;
     $trip->trip_date = $request->trip_date;
     $trip->notes = $request->notes;
     // Save the Order
     $trip->save();
     session()->flash('message', 'Range Trip has been Saved');
     session()->flash('message-type', 'success');
     return redirect()->action('TripController@show', [$trip->id]);
 }
Ejemplo n.º 3
0
 /**
  * @param $code
  * @param $trip_id
  * @param $passengers
  *
  * @return bool
  */
 public function checkIfCashCardCodeIsValid($code, $trip_id, $passengers)
 {
     $trip = Trip::find($trip_id);
     $card = CashCode::whereraw('code = ?', [$code])->first();
     if ($card) {
         $price = $card->price;
         $card_id = $card->id;
         if ($price == $trip->fare * $passengers) {
             Session::put('card_id', $card_id);
             $this->useCard($card_id);
             return true;
         } elseif ($price > $trip->fare * $passengers) {
             Session::put('card_id', $card_id);
             $this->useCard($card_id);
             return true;
         } else {
             return false;
         }
     } else {
         return false;
     }
 }
Ejemplo n.º 4
0
 /**
  * @param Request $request
  *
  * @return $this|\Illuminate\View\View
  */
 public function pay_reserve_booking_now(Request $request)
 {
     $booking = Booking::find($request->booking_id);
     $trip = Trip::find($booking->trip_id);
     $trip_id = $trip->id;
     $passengers = 1;
     $travel_company_id = $trip->travel_company_id;
     if ($request->has('cashcard_code')) {
         $code = strtoupper($request->cashcard_code);
         if ($this->cashCard->checkIfCashCardCodeIsValid($code, $trip->id, $passengers)) {
             $status = "paid";
             $booking->status = $status;
             $booking->ticket_number = rand() . time();
             $booking->save();
             Payment::create(['trip_id' => $booking->trip->id, 'amount' => $booking->trip->fare, 'user_id' => Auth::user()->get()->id, 'booking_id' => $booking->id, 'travel_company_id' => $travel_company_id]);
             $user = Auth::user()->get();
             //				$mail = view('mails.ticket')->render();
             Session::put('r_b_c_data', $booking);
             Session::put('r_b_c_passengers', $passengers);
             Session::put('r_b_c_trip_id', $trip_id);
             //				Mail::send('mails.new', ['user' => $user], function ($m) use ($user) {
             //		            $m->to($user->email, $user->name)->subject('Passenger name booking detail');
             //		        });
             return redirect()->route('reserved-trip-paid');
         } else {
             return redirect()->back()->withErrors('There was a problem processing the payment');
         }
     } elseif ($request->has('speedBanking_code')) {
         $code = $request->speed_banking_code;
         if ($this->cashCard->checkIfCashCardCodeIsValid($code, $trip->id, $passengers)) {
             dd('paying speedBanking');
             $status = "paid";
             //				$this->insert($passengers, $request->all(), $user_id, $trip_id, $status);
             return view('payment.success');
         } else {
             return redirect()->back()->withErrors('There was a problem processing the payment');
         }
     }
 }
Ejemplo n.º 5
0
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Request $request, $tripID, $id)
 {
     // create the new Order
     $shoot = Shoot::find($id);
     $trip = Trip::find($tripID);
     $bullet = Bullet::find($request->bullet_id);
     // Get the data
     $shoot->rounds = $request->rounds;
     $shoot->firearm_id = $request->firearm_id;
     $shoot->notes = $request->notes;
     $shoot->trip()->associate($trip);
     $shoot->bullet()->associate($bullet);
     // Save the Order
     $shoot->save();
     // Update inventory for all Bullets
     Bullet::updateInventory();
     session()->flash('message', 'Shoot has been Saved');
     session()->flash('message-type', 'success');
     return redirect()->action('ShootController@show', [$trip->id, $shoot->id]);
 }
Ejemplo n.º 6
0
 /**
  * @param $trip_id
  *
  * @return mixed
  */
 private function checkIfTripIsAvailable($trip_id)
 {
     $trip = Trip::find($trip_id);
     return $trip;
 }
Ejemplo n.º 7
0
 /**
  * @param $reporting_time
  * @param $time_frame
  *
  * @return bool
  */
 public function isTimeCorrect($reporting_time, $time_frame, $trip_id)
 {
     $trip = Trip::find($trip_id);
     //			dd($trip);
     $realTime = $this->carbonDate($trip_id, $this->carbonize($this->timeStringtify($reporting_time)));
     $from = $time_frame['from'];
     $to = $time_frame['to'];
     if ($from <= $realTime and $realTime <= $to) {
         //				dd('cool');
         return true;
     } else {
         //				dd($realTime);
         return false;
     }
 }
 public function booking_report_generate(Request $request)
 {
     $this->validate($request, ['trip_id' => 'required']);
     $trip_id = $request->trip_id;
     $bookings = Booking::where('trip_id', $trip_id)->where('status', 'paid')->get();
     if (!$bookings) {
         session()->put('info', 'No Data');
         return redirect()->back();
     }
     $trip = Trip::find($trip_id);
     $date = Carbon::today()->toFormattedDateString();
     $this->downloadBookingReportInPdf($bookings, $date, $trip);
     //        dd($request->all(), $bookings, $trip);
 }