/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $company_id = Auth::travel_company_staff()->get()->travel_company->id;
     $trips = Trip::whereraw('travel_company_id = ?', [$company_id])->orderBy('created_at', 'desc')->get();
     $sN = Station::whereraw('travel_company_id = ?', [$company_id])->count();
     return view('companies.trips.index', ['stations_number' => $sN])->with('trips', $trips);
 }
 /**
  * @return \Illuminate\View\View
  */
 public function dashboard()
 {
     $company_id = Auth::travel_company_staff()->get()->travel_company->id;
     $number_of_trips = Trip::whereraw('travel_company_id = ?', [$company_id])->count();
     $number_of_stations = Station::whereraw('travel_company_id = ?', [$company_id])->count();
     $number_of_paid_bookings = Booking::whereraw('travel_company_id = ? AND status = ?', [$company_id, 'paid'])->count();
     $number_of_travel_bookings = Booking::whereraw('travel_company_id = ? AND status = ? AND updated_at > ?', [$company_id, 'paid', Carbon::today()])->count();
     return view('companies.account.dashboard', ['number_of_trips' => $number_of_trips, 'number_of_stations' => $number_of_stations, 'number_of_paid_bookings' => $number_of_paid_bookings, 'number_of_travel_bookings' => $number_of_travel_bookings]);
 }
 /**
  * @param $from
  * @param $to
  *
  * @return array
  */
 private function getTodayOneWayTrips($from, $to)
 {
     //		dd($this->time->currentTimeFrame());
     if ($this->time->currentTimeFrame() == "Morning") {
         $trips = Trip::whereraw('departure_date = ? AND departure_station = ? AND destination_station = ?', [Carbon::today(), $from, $to])->whereIn('departure_time', ['Afternoon', 'Evening'])->get();
     } elseif ($this->time->currentTimeFrame() == "Afternoon" or $this->time->currentTimeFrame() == "Evening") {
         //		    $trips = Trip::whereraw('departure_date = ? AND departure_station = ? AND destination_station = ?',
         //			    [Carbon::today(), $from, $to])
         //			    ->where('departure_time', 'Evening')
         //			    ->get();
         $trips = [];
     } else {
         $trips = [];
     }
     return $trips;
 }