public function testDestroy() { $user = factory(User::class)->create(); $this->action('DELETE', 'Admin\\UsersController@destroy', $user); $this->assertRedirectedToRoute('admin.users.index'); $this->assertEquals(0, User::count()); }
/** * GET /admin/users * Display a listing of users. * * @return \Illuminate\View\View */ public function index() { $postsCount = Post::count(); $seriesCount = Series::count(); $projectsCount = Project::count(); $usersCount = User::count(); return view('admin.pages.index', compact('postsCount', 'seriesCount', 'projectsCount', 'usersCount'))->withTitle('Admin'); }
/** * DELETE /admin/users/id * Remove a user from storage. * * @param \NeonTsunami\User $user * @return \Illuminate\Http\RedirectResponse */ public function destroy(User $user) { $user->delete(); return redirect()->route('admin.users.index')->withSuccess('The user was deleted.'); }