Пример #1
0
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     $tours = Tour::where('is_published', true)->where('start', '>', Carbon::now()->addHours(3))->whereHas('segments', function ($q) {
         if (Input::has('filter.from')) {
             $q->whereHas('from', function ($q) {
                 $q->where('city', Input::get('filter.from'));
             });
         }
     })->whereHas('segments', function ($q) {
         if (Input::has('filter.to')) {
             $q->whereHas('to', function ($q) {
                 $q->where('city', Input::get('filter.to'));
             });
         }
     })->get();
     $from_cities = Address::has('segments_from');
     $to_cities = Address::has('segments_to');
     return view('tour.index')->with('tours', $tours)->with('from_cities', $from_cities)->with('to_cities', $to_cities)->with('filter', Input::get('filter'));
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $tour, $booking
  * @return Response
  */
 public function destroy($tour, $booking)
 {
     $tour = Tour::where('is_published', true)->findOrFail($tour);
     $booking = $tour->bookings()->findOrFail($booking);
     //TODO
 }