/** * Display a listing of the resource. * * @return Response */ public function index() { $artists = Artist::get()->all(); $artists = Artist::paginate(15); return view('artists.index', compact('artists')); //compact hace un arreglo }
/** * Display a listing of the resource. * * @return Response */ public function index() { if (Auth::check()) { if (Auth::user()->is_admin) { $artists = \App\Artist::paginate(5); return view('cantantes.index', compact('artists')); } return redirect('inicio'); } else { return redirect(url()); } }
public function index(Request $request) { $artists = Artist::paginate(); return $artists; }