PHP code example of sandrocagara / laravelmultiauth

1. Go to this page and download the library: Download sandrocagara/laravelmultiauth library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sandrocagara / laravelmultiauth example snippets


Route::get('/', function () {
    return view('welcome');
});

Auth::routes();
Route::prefix('home')->group(function() {
    Route::get('/', 'HomeController@index')->name('home');

    Route::get('/change-password','HomeController@showChangePasswordForm')->name('home.change-password.form');
    Route::post('/change-password', 'HomeController@changePassword')->name('home.change-password.submit');

    Route::get('/logout', 'Auth\LoginController@userlogout')->name('home.logout');
});

Route::prefix('admin')->group(function() {
    Route::get('/login', 'Auth\AdminLoginController@showLoginForm')->name('admin.login.form');
    Route::post('/login', 'Auth\AdminLoginController@login')->name('admin.login.submit');

    Route::get('/', 'AdminHomeController@index')->name('admin.home');

    Route::get('/change-password','AdminHomeController@showChangePasswordForm')->name('admin.change-password.form');
    Route::post('/change-password','AdminHomeController@changePassword')->name('admin.change-password.submit');

    Route::get('/logout', 'Auth\AdminLoginController@logout')->name('admin.logout');

    Route::post('/password/email', 'Auth\AdminForgotPasswordController@sendResetLinkEmail')->name('admin.password.email');
    Route::get('/password/reset', 'Auth\AdminForgotPasswordController@showLinkRequestForm')->name('admin.password.request');
    Route::post('/password/reset', 'Auth\AdminResetPasswordController@reset')->name('admin.reset');
    Route::get('/password/reset/{token}', 'Auth\AdminResetPasswordController@showResetForm')->name('admin.password.reset');
});

Route::prefix('super-admin')->group(function() {
    Route::get('/login', 'Auth\SuperAdminLoginController@showLoginForm')->name('super-admin.login.form');
    Route::post('/login', 'Auth\SuperAdminLoginController@login')->name('super-admin.login.submit');

    Route::get('/', 'SuperAdminHomeController@index')->name('super-admin.home');

    Route::get('/change-password', 'SuperAdminHomeController@showChangePasswordForm')->name('super-admin.change-password.form');
    Route::post('/change-password', 'SuperAdminHomeController@changePassword')->name('super-admin.change-password.submit');

    Route::get('/logout', 'Auth\SuperAdminLoginController@superAdminlogout')->name('super-admin.logout');

    Route::post('/password/email', 'Auth\SuperAdminForgotPasswordController@sendResetLinkEmail')->name('super-admin.password.email');
    Route::get('/password/reset', 'Auth\SuperAdminForgotPasswordController@showLinkRequestForm')->name('super-admin.password.request');
    Route::post('/password/reset', 'Auth\SuperAdminResetPasswordController@reset')->name('super-admin.reset');
    Route::get('/password/reset/{token}', 'Auth\SuperAdminResetPasswordController@showResetForm')->name('super-admin.password.reset');
});

Route::prefix('account')->group(function() {
    Route::get('/user/verified/{token}', 'Auth\RegisterController@accountVerification');
});

Route::fallback(function(){
    return back();
});

php artisan migrate

'passwords' => [
     'users' => [
         'provider' => 'users',
         'table' => 'password_resets',
         'expire' => 30, <-HERE
     ],

     'admins' => [
         'provider' => 'admins',
         'table' => 'password_resets',
         'expire' => 30, <-HERE
     ],

     'super_admins' => [
         'provider' => 'super_admins',
         'table' => 'password_resets',
         'expire' => 30, <-HERE
     ],
 ],

php artisan tinker