Laravel: Artisan Extended – make:route

Today, I want to share with you guys how to create easily the resourceful route, with or without prefix (yes, you can make route version too!).

First thing first, let’s create a new Laravel project and require the Artisan Extended package to your Laravel Project.

Once you’re done with installation of Artisan Extended package, you may run now in terminal the following commands:

php artisan make:route Post

This will create a new Routes directory in your app folder, and a file named Post.php(app/Routes/Post.php), and you will have \App\Routes\Post::routes(); in your routes/web.php. You may run php artisan route:list to check the route created just now.

Now, let say you want to add prefix to your route:

php artisan make:route -p v1 Post

Then, you will have \App\Routes\V1\Post::routes(); in your routes/web.php

How about I want a prefix of V1, but I want to differentiate between admin and normal user? Here how you can do it: