/**
  * Store a newly created resource in storage.
  *
  * @param Request $request
  *
  * @return Response
  */
 public function store(Request $request, Trip $trip)
 {
     $company = Auth::travel_company_staff()->get()->travel_company;
     $stations = $company->stations->lists('city')->toArray();
     $dps = $request->departure_station;
     $des = $request->destination_station;
     $this->validate($request, ['departure_station' => "required | different:destination_station", 'departure_date' => "required", 'departure_time' => 'required', 'destination_station' => "required", 'fare' => 'required', 'transport_model' => 'required', 'hour' => 'integer|required', 'minute' => 'integer|required', 'boarding_point' => 'required', 'number_of_seats' => 'required|integer']);
     if (!in_array($dps, $stations) or !in_array($des, $stations)) {
         return redirect()->back()->withInput()->withErrors('Invalid Station');
     }
     $departure_date = $this->carbonize($request->departure_date);
     if ($departure_date->lte(Carbon::tomorrow())) {
         return redirect()->back()->withInput()->withErrors('Invalid Departure Date');
     }
     $min = $request->minute;
     $hour = $request->hour;
     $duration = $this->durationize($hour, $min);
     $slug = str_slug($request->departure_station . ' to ' . $request->destination_station);
     $code = $trip->code();
     $input = array_add($request->except(['minute', 'hour']), 'code', $code);
     $input['departure_date'] = $departure_date;
     $input = array_add($input, 'travel_company_id', $company->id);
     $input = array_add($input, 'duration', $duration);
     $input = array_add($input, 'slug', $slug);
     Trip::create($input);
     return redirect()->route('company.trips.index');
 }