/** * Display a listing of the Tracking. * * @param Request $request * @return Response */ public function index(Request $request, $location_id) { $location = $this->locationRepository->findWithoutFail($location_id); if (empty($location)) { Flash::error('Location not found'); return redirect(route('inserter.locations.index')); } $this->trackingRepository->orderBy('id', 'desc')->pushCriteria(new RequestCriteria($request)); $trackings = $this->trackingRepository->locatedAt($location_id)->pending()->with('facing')->paginate(25); return view('inserter.locations.trackings.index')->with('location', $location)->with('trackings', $trackings); }
/** * Display a listing of the Tracking. * * @param Request $request * @return Response */ public function index(Request $request) { $this->trackingRepository->orderBy('id', 'desc')->pushCriteria(new RequestCriteria($request)); $location_id = $request->location_id; if (empty($location_id)) { $trackings = $this->trackingRepository; } else { $trackings = $this->trackingRepository->locatedAt($location_id); } $trackings = $trackings->with('location')->with('billboardOwner')->with('product')->with('brand')->with('facing')->with('user')->paginate(25); $locations = Location::lists('city', 'id'); return view('trackings.index')->with('trackings', $trackings)->with('locations', $locations)->with('location_id', $location_id); }