/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $data = []; $user = User::find(Auth::user()->id); if (!$user) { return redirect("auth/login"); } $folders = Folder::rootFolders($user); if (count($folders) > 0) { $data["folders"] = $folders; } $files = File::rootFiles($user); if (count($files) > 0) { $data["files"] = $files; } return view('index', $data); }