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:
bash
php 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:
php
<?php
use Illuminate\Support\Facades\Route;
Route::get('customer', [
'uses' => 'CustomerController@index',
])->name('customer.index');
Route::get('customer/create', [
'uses' => 'CustomerController@create',
])->name('customer.create');
Route::get('customer/{id}/edit', [
'uses' => 'CustomerController@edit',
])->name('customer.edit');
Route::post('customer', [
'uses' => 'CustomerController@store',
])->name('customer.store');
Route::put('customer/{id}', [
'uses' => 'CustomerController@update',
])->name('customer.update');
Route::delete('customer/{id}', [
'uses' => 'CustomerController@destroy',
])->name('customer.destroy');
// profile routes
Route::get('profile', [
'uses' => 'ProfileController@index',
])->name('profile.index');
Route::get('profile/create', [
'uses' => 'ProfileController@create',
])->name('profile.create');
Route::get('profile/{id}/edit', [
'uses' => 'ProfileController@edit',
])->name('profile.edit');
Route::post('profile', [
'uses' => 'ProfileController@store',
])->name('profile.store');
Route::put('profile/{id}', [
'uses' => 'ProfileController@update',
])->name('profile.update');
Route::delete('profile/{id}', [
'uses' => 'ProfileController@destroy',
])->name('profile.destroy');