Laravel Separate Views for Admin or Backend and Frontend

Written by Jigesh Raval on April 16, 2019

This article is about to set up the different scope, Admin or Front, to serve distinctive Route, Controller and view files. This can make a Laravel application more organized.

First, we will see how can we arrange different views for two different sides, admin and front, of the Laravel application.

Let’s start coding it.

1. Laravel Distinct/Separate Views for Admin or Backend and Frontend

Step 1: Open config/app.php and add two new keys “app_scope” and “admin_route”


Laravel Separate Views for Admin or Backend and FrontendBy default, this value should be “front” for the key “app_scope”.

Step 2: Open app/Providers/AppServiceProvider.php

  1. In this file first, use App\Http\Request at the top of the file
  2. Add the following code in function boot

Now, if you use the code view(‘welcome’) anywhere in the application then it will result try to find file welcome.blade.php in the folder /resources/front/welcome.blade.php

Step 3: Move all the files from resources/views to resources/admin/views and try to visit your homepage, this should work fine.

Step 4: Open routes/web.php file and add the following route to it.

Step 5: Create a file login.blade.php under the directory resources/admin

Step 6: Create a layout file under resources/admin/layouts/admin_app.blade.php, remember this file will be called in any new template we are going to use in the admin to call the header and the footer.

Please watch my video: link here for thorough instructions or download source code directly from Github.