Create a Custom route in Laravel 6

In this blog, I will teach you how to create a custom route in laravel.

Generally, Laravel provides the most popular two route system web.php and api.php but another scenario you want to create a route only for admin panel then you should create a custom route.

So, Let’s start our tutorial

Step 1: Create a new file in routes.

Create a new file name is admin.php

Step 2: Changes in RouteServiceProvider

Open file app\Providers\RouteServiceProvider.php and put the below code:


namespace App\Providers;

use Illuminate\Support\Facades\Route;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;

class RouteServiceProvider extends ServiceProvider
    protected $namespace = 'App\Http\Controllers';
    public function boot(){
    public function map(){
    protected function mapWebRoutes(){
    protected function mapApiRoutes(){
    protected function mapAdminRoutes(){

Now you can put the code in your admin.php file



I guess it will help you!

Happy Coding!

About Dhaval Shah

My name is Dhaval Shah. I'm a Laravel developer. I live in India and I love to write tutorials and tips that can help other developers. I am a big fan of PHP, Java-script, JQuery, Laravel, WordPress, and Bootstrap.
Follow me on Github / Linkedin

Leave a Reply

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

Subscribe To Our Newsletter
Enter your email to receive a weekly round-up of our best posts. Learn more!