Run Publish Layout Command
Generator also provides a quick way to publish layout and auth scaffold for laravel 5.1 using the following command.
php artisan infyom.publish:layout
Check Published Stuff
This command generates following files,
It will publish HomeController
in controllers directory
- It will publish views
- For Laravel 5.1,
OR following for Laravel 5.2
- It will add following routes which need to get it work.
Route::get('login', 'Auth\AuthController@getLogin');
Route::post('login', 'Auth\AuthController@postLogin');
Route::get('logout', 'Auth\AuthController@getLogout');
// Registration Routes...
Route::get('register', 'Auth\AuthController@getRegister');
Route::post('register', 'Auth\AuthController@postRegister');
// Password Reset Routes...
Route::get('password/reset', 'Auth\PasswordController@getEmail');
Route::post('password/email', 'Auth\PasswordController@postEmail');
Route::get('password/reset/{token}', 'Auth\PasswordController@getReset');
Route::post('password/reset', 'Auth\PasswordController@postReset');
Route::get('/home', 'HomeController@index');
Laravel 5.1 Customization
If you are using Laravel 5.1, then you need to do following two changes:
Open
app/Http/Middleware/Authenticate.php
.Find the line
return redirect()->guest('auth/login');
inhandle
function and replace it with,return redirect()->guest('/login');
Open app/Http/Controllers/Auth/AuthController
.php and add the following properties
protected $loginPath = '/login';
protected $redirectTo = '/home';
protected $redirectAfterLogout = '/login';
Menu Configuration
Now, you have to enable menu option in config/infyom/laravel_generator.php
. Make menu option true.
'add_on' => [ 'menu' => [ 'enabled' => true ] ]
add_on.menu.menu_file
is where menu for particular module will be added. If you want to customize it then you can customize it. It will take a respective path from views folder you configured in laravel_generator.php
.
Now we are all set and you can check basic scaffolding.