/** * @param Post $post * @param User $user * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function index(Post $post, User $user) { $posts = $post->latest('updated_at')->take(5)->get(); $users = $user->whereNotNull('last_login_at')->latest('last_login_at')->take(5)->get(); return view('backend.dashboard', compact('posts', 'users')); }
/** * Remove the specified resource from storage. * * @param DeleteUserRequest $request * @param int $id * @return \Illuminate\Http\Response */ public function destroy(DeleteUserRequest $request, $id) { $this->user->findOrFail($id)->delete(); return redirect()->route('backend.users.index')->withStatus('User has been deleted'); }