Skip to content

Route Generator ‚Äč

The Route Generator Command, will create a new route file for the informed Module if the file routes/app.php doesn't exists inside the Module's directory. If the Module's route file already existis, the commando will append the Resource routes to it, with route default names, methods and actions. For example: if you want to create default routes for the Customer/ProfileController.php file, you can run the following command:

php artisan modular:make-route Customer Profile

Or if you are using Laravel Sail, run:

sail artisan modular:make-route Customer Profile

The Profile default routes, mapping to the default ProfileController, will be appended to the modules/Customer/routes/app.php file, as follows:


use Illuminate\Support\Facades\Route;

Route::get('customer', [
    'uses' => 'CustomerController@index',

Route::get('customer/create', [
    'uses' => 'CustomerController@create',

Route::get('customer/{id}/edit', [
    'uses' => 'CustomerController@edit',

Route::post('customer', [
    'uses' => 'CustomerController@store',

Route::put('customer/{id}', [
    'uses' => 'CustomerController@update',

Route::delete('customer/{id}', [
    'uses' => 'CustomerController@destroy',

// profile routes

Route::get('profile', [
    'uses' => 'ProfileController@index',

Route::get('profile/create', [
    'uses' => 'ProfileController@create',

Route::get('profile/{id}/edit', [
    'uses' => 'ProfileController@edit',

Route::post('profile', [
    'uses' => 'ProfileController@store',

Route::put('profile/{id}', [
    'uses' => 'ProfileController@update',

Route::delete('profile/{id}', [
    'uses' => 'ProfileController@destroy',