Giter Club home page Giter Club logo

laravel5.3demo's Introduction

Laravel-5.3 Demo

laravel 5.3 Demo for Multiauth with user and admin table

Configurations:

/config/auth.php

[ 'guard' => 'web', 'passwords' => 'users', ], /* |-------------------------------------------------------------------------- | Authentication Guards |-------------------------------------------------------------------------- | | Next, you may define every authentication guard for your application. | Of course, a great default configuration has been defined for you | here which uses session storage and the Eloquent user provider. | | All authentication drivers have a user provider. This defines how the | users are actually retrieved out of your database or other storage | mechanisms used by this application to persist your user's data. | | Supported: "session", "token" | */ 'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], 'user' => [ 'driver' => 'session', 'provider' => 'users', ], 'admin' => [ 'driver' => 'session', 'provider' => 'admins', ], 'api' => [ 'driver' => 'token', 'provider' => 'users', ], ], /* |-------------------------------------------------------------------------- | User Providers |-------------------------------------------------------------------------- | | All authentication drivers have a user provider. This defines how the | users are actually retrieved out of your database or other storage | mechanisms used by this application to persist your user's data. | | If you have multiple user tables or models you may configure multiple | sources which represent each model / table. These sources may then | be assigned to any extra authentication guards you have defined. | | Supported: "database", "eloquent" | */ 'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => App\Model\frontend\User::class, ], 'admins' => [ 'driver' => 'eloquent', 'model' => App\Model\backend\Admin::class, ], // 'users' => [ // 'driver' => 'database', // 'table' => 'users', // ], ], /* |-------------------------------------------------------------------------- | Resetting Passwords |-------------------------------------------------------------------------- | | You may specify multiple password reset configurations if you have more | than one user table or model in the application and you want to have | separate password reset settings based on the specific user types. | | The expire time is the number of minutes that the reset token should be | considered valid. This security feature keeps tokens short-lived so | they have less time to be guessed. You may change this as needed. | */ 'passwords' => [ 'users' => [ 'provider' => 'users', 'table' => 'password_resets', 'expire' => 60, ], 'admins' => [ 'provider' => 'admins', 'table' => 'admins_password_resets', 'expire' => 60, ], ], ]; # routes/web.php ['guest']], function () { Route::get('/', function () { return view('welcome'); }); Route::get('/home', function () { return view('frontend.home'); }); // ADMIN Route::get('admin/login', 'backend\Auth\LoginController@getLoginForm'); Route::post('admin/authenticate', 'backend\Auth\LoginController@authenticate'); Route::get('admin/register', 'backend\Auth\RegisterController@getRegisterForm'); Route::post('admin/saveregister', 'backend\Auth\RegisterController@saveRegisterForm'); // USER Route::get('user/login', 'frontend\Auth\LoginController@getLoginForm'); Route::post('user/authenticate', 'frontend\Auth\LoginController@authenticate'); Route::get('user/register', 'frontend\Auth\RegisterController@getRegisterForm'); Route::post('user/saveregister', 'frontend\Auth\RegisterController@saveRegisterForm'); }); Route::group(['middleware' => ['user']], function () { Route::post('user/logout', 'frontend\Auth\LoginController@getLogout'); Route::get('user/dashboard', 'frontend\UserController@dashboard'); Route::get('user/dashboard1/', function () { return view('frontend.dashboard'); }); }); Route::group(['middleware' => ['admin']], function () { Route::get('admin/dashboard', 'backend\AdminController@dashboard'); Route::post('admin/logout', 'backend\Auth\LoginController@getLogout'); }); # app/Http/Kernel.php Add with protected $routeMiddleware = [ + 'admin' => \App\Http\Middleware\CheckAdmin::class, + 'user' => \App\Http\Middleware\CheckUser::class, #/app/Http/Middleware CheckAdmin.php ->> For check admin CheckUser.php ->> For check user # Migration Tables ## /database/migrations 2014_10_12_000000_create_users_table.php 2014_10_12_100000_create_password_resets_table.php 2016_10_18_131257_create_admins_table.php 2016_10_18_131630_create_admins_passowrd_resets_table.php # Import Tables : Excecute php artisan migrate

laravel5.3demo's People

Contributors

aneeshsudhakaran avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.