mysql - Laravel multip auth system gives error this error (These credentials do not match our records) when I try to login as admin -
i’m new in laravel, want make multi auth system in laravel 5.4. copied auth directory of default user controllers admin directory , set namespace.
i made second guard admin script
return [ /* |-------------------------------------------------------------------------- | authentication defaults |-------------------------------------------------------------------------- | | option controls default authentication "guard" , password | reset options application. may change these defaults | required, they're perfect start applications. | */ 'defaults' => [ 'guard' => 'web', 'passwords' => 'users', ], /* |-------------------------------------------------------------------------- | authentication guards |-------------------------------------------------------------------------- | | next, may define every authentication guard application. | of course, great default configuration has been defined | here uses session storage , eloquent user provider. | | authentication drivers have user provider. defines how | users retrieved out of database or other storage | mechanisms used application persist user's data. | | supported: "session", "token" | */ 'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], 'admin' => [ 'driver' => 'session', 'provider' => 'admins', ], 'api' => [ 'driver' => 'token', 'provider' => 'users', ], ], /* |-------------------------------------------------------------------------- | user providers |-------------------------------------------------------------------------- | | authentication drivers have user provider. defines how | users retrieved out of database or other storage | mechanisms used application persist user's data. | | if have multiple user tables or models may configure multiple | sources represent each model / table. these sources may | assigned authentication guards have defined. | | supported: "database", "eloquent" | */ 'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => app\model\user\user::class, ], 'admins' => [ 'driver' => 'eloquent', 'model' => app\model\admin\admin::class, ], // 'users' => [ // 'driver' => 'database', // 'table' => 'users', // ], ], /* |-------------------------------------------------------------------------- | resetting passwords |-------------------------------------------------------------------------- | | may specify multiple password reset configurations if have more | 1 user table or model in application , want have | separate password reset settings based on specific user types. | | expire time number of minutes reset token should | considered valid. security feature keeps tokens short-lived | have less time guessed. may change needed. | */ 'passwords' => [ 'users' => [ 'provider' => 'users', 'table' => 'password_resets', 'expire' => 60, ], 'admins' => [ 'provider' => 'admins', 'table' => 'password_resets', 'expire' => 60, ], ], ];
- over write guard function in authenticatesusers.php in admin login controller admin guard. without overwriting it’s working fine logging user not admin when overwrite admin gives error (these credentials not match our records.)
Comments
Post a Comment