/** * Show the application dashboard to the user. * * @return Response */ public function index() { $user = \Auth::user(); $posts = \App\Post::all(); $posts = \App\Post::paginate(3); $users = \App\User::all(); $users = \App\User::paginate(3); $fiches = \App\Fiche::all(); if ($user->role == "teacher") { $fiches = \App\Fiche::paginate(3); } if ($user->role == "teacher") { return view('back.index', compact('posts', 'users', 'fiches', 'user')); } else { return view('backStudent.index', compact('fiches', 'user')); } }
/** * Show the form for creating a new resource. * * @return Response */ public function createFiche() { $fiches = \App\Fiche::all(); $user = \Auth::user(); return view('back.newFiche', compact('fiches', 'user')); }