/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $tracks = Track::all(); if ($tracks) { return view('publictransport', compact('tracks')); } else { return view('publictransport'); } }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $tracks = Track::all(); return view('list-tracks')->with('tracks', $tracks); }