Backend Admin Template – WordPress-Like Blog Laravel 5.7 and AdminLTE 3 (9)

WordPress-Like Blog Laravel 5.7 and AdminLTE 3 (9) – Backend Admin Template

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

  1. Create authorization for backend login
  2. Create Login Page using AdminLTE template
  3. Create backend template using AdminLTE 3
  4. Redirect to login page after logout

Create Authorization for Backend Login

This second section of this case study is hovering around the backend template and backend programming. The first thing we need to do is to create the backend admin template using AdminLTE 3.

To create the authorization, open terminal and type the command :

This command will create to routes in routes/web.php

Open http://localhost:8000/login and try to login using username and password that we had made using UsersTableSeeder :

Membuat Blog dengan Laravel 5.7 dan AdminLTE 3 (9) – Template Backend

If we put the correct username and password, we will be redirected to the Home page :

Membuat Blog dengan Laravel 5.7 dan AdminLTE 3 (9) – Template Backend 2

Create Login Page using AdminLTE template

Now we will change the original laravel template to adminLTE login template. We can see the AdminLTE login template example here : https://adminlte.io/themes/dev/AdminLTE/pages/examples/login.html

Let’s create the assets folder for the backend template. Create new folder ‘backend’ inside public folder. Inside this backend folder, we will put adminlte assets, the dist and plugin folder. You can download it from my github here :

https://github.com/andriindocoder/laravel56-adminlte/tree/master/public/backend

Next, open resources/views/layouts/app.blade.php, replace all the codes there with this one :

Open login.blade.php inside resources/views/auth directory, and replace the codes inside with the following one :

Now if we open the login page, the template will already changed :

Membuat Blog dengan Laravel 5.7 dan AdminLTE 3 (9) – Template Backend 3

Create backend template using AdminLTE 3

Go to https://adminlte.io/themes/dev/AdminLTE/index.html to have a look at AdminLTE 3.

Create new folder ‘backend’ inside resources/views/layouts directory. Inside this backend folder, there are three files to display the AdminLTE Dashboard :

main.blade.php

 

navbar.blade.php

sidebar.blade.php

Next, modify home.blade.php like this one :

When you logged in successfully, you will be redirected to the AdminLTE3 template Dashboard :

Membuat Blog dengan Laravel 5.7 dan AdminLTE 3 (9) – Template Backend 4

Now, let’s create a new folder to store controller related to Backend admin. Create Backend folder inside App\Http\Controllers. Create BackendController.php inside this folder.

Move HomeController.php to App\Http\Controllers\Backend directory, and modify the lines as follows :

Since we moved the HomeController, we need to modify the routes/web.php as well :

Redirect to Login Page after Logout

At the moment, when we logout we will be redirected to frontend page. We want to change this so we will be redirected to login page. To do this, open App\Http\Controllers\Auth\LoginController.php and add logout() method :

Don’t forget to add the namespace :

Our AdminLTE Dashboard has finished.

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.