/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { /* * Return all agencies since there aren't that many */ $agencies = Agency::all(); /* * If we are in the admin panel, render a view * otherwise return as json */ $routeName = \Route::getCurrentRoute()->getName(); return $routeName == 'dash.agencies' ? view('dashboard.agencies.index', compact('agencies')) : $agencies; }
public function index() { $agencies = Agency::all(); return $this->respond(fractal()->collection($agencies, new AgencyTransformer())->toArray()); }
public function index() { $users = User::all(); $agencies = Agency::all(); return view('admin.adminIndex', compact('users', 'agencies')); }