I'm using laravel's built in auth system.I have a page for admin login on admin/login.If I entered wrong username and password it redirects me to default auth/login instead of admin/login with erros.How do I fix it?
I want normal users to login via auth/login and admin via admin/login
How do I do that?
If you are using laravel 5, and the AuthenticatesAndRegistersUsers
trait on the controller that is a handling your admin login, you can set the $loginPath
property on your controller to override the default login path (which is - as you say, 'auth/login'
).
class AdminAuthController extends Controller {
use AuthenticatesAndRegistersUsers;
/**
* Override login path property
*
* @var string
*/
protected $loginPath = 'admin/login';
}
You can add a similar $redirectPath
property to change the default redirect path for a successful login. (This defaults to /home
)
NB - this requires you to be using a different controller for your normal user and admin logins
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments