@aniya.jaskolski
To override the auth login function in Laravel, you can follow these steps:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
namespace AppHttpControllersAuth;
use IlluminateFoundationAuthAuthenticatesUsers;
class CustomLoginController extends AppHttpControllersAuthLoginController
{
use AuthenticatesUsers;
// Override the login function here
public function login(Request $request)
{
// Your custom login logic here
}
}
|
1
|
Route::post('login', 'AuthCustomLoginController@login')->name('login');
|
1
|
$this->app['router']->aliasMiddleware('auth', AppHttpControllersAuthCustomLoginController::class);
|
Now, you have successfully overridden the auth login function in Laravel and can customize it according to your needs.