/** * Display Bus root informations * Check user is logged or not, if not return login page * Otherwise get the nearest bus stops to the user * * @return Response */ public function index() { if (!Auth::guest()) { $busLib = new BusServiceLib(); $busStops = $busLib->getUserNearestLocation(); return view("home", ['busStops' => $busStops]); } else { return view("auth/login"); } }
/** * Display Bus arrival times of the given bus stop * Check user is logged or not, if not return login page * Otherwise get the bus arrival time and bus stop info * * @return a view */ public function getBusArrivalTimes($stopID) { if (!Auth::guest()) { $busLib = new BusServiceLib(); $busRoutes = $busLib->getBusArrivalTimes($stopID); $bushalt = BusStop::where('bus_stop_id', $stopID)->first(); return view("businfo/busStopInfo", ['busRoutes' => $busRoutes, 'busHaltInfo' => $bushalt]); } else { return redirect("auth/login"); } }