Manage Users – WordPress-Like Blog Laravel 5.7 and AdminLTE 3 (16)

WordPress-Like Blog Laravel 5.7 and AdminLTE 3 (16) – Manage Users

In this sixteenth part of creating WordPress-Like Blog using Laravel 5.7 and AdminLTE 3, we will :

  1. Add Users Menu
  2. Display Users
  3. Add User
  4. Edit User
  5. Delete User

Add Users Menu

Add users menu inside sidebar.blade.php

Display Users

Add another routes :

Create UsersController.php inside App\Http folder, just copy from CategoryController.php that we have and do some proper modifications.

Next, copy folder category inside views/backend folder and rename it as users folder.

index.blade.php

table.blade.php

config/cms.php

Let’s test it :

Manage Users - WordPress-Like Blog Laravel 5.7 and AdminLTE 3 (16)

Continue to edit files :

users/create.blade.php

users/edit.blade.php

form.blade.php

The next step is to create three requests :

App\Http\Requests\UserStoreRequest.php

UserUpdateRequest.php

For the destroy method, we will take another approach. If the user has many posts, the administrator will have a choice whether to also delete the post from that user, or move the post to another user.

Modify UsersController.php and add confirm() method :

Add another route to routes/web.php

Modify view users/table.blade.php on this part :

Add confirm.blade.php inside views/user folder :

Run the application, you will be able to choose whether to delete the posts by deleted author or attribute the post to another author :

Manage Users - WordPress-Like Blog Laravel 5.7 and AdminLTE 3 (16)2

Modify destroy() method inside UsersController.php :

Add authorize() method to UserDestroyRequest:

Github commit.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.