close slash login in laravel 8

563 0 0 0

Last Updated : 2024-05-02 19:37:27

how to close /login in laravel 8

this process in laravel 8 located in :

vendor/laravel/fortify/src/Http/Controllers/AuthenticatedSessionController.php

change this section


/**
* Show the login view.
*
* @param \Illuminate\Http\Request $request
* @return \Laravel\Fortify\Contracts\LoginViewResponse
*/
public function create(Request $request): LoginViewResponse
{
return app(LoginViewResponse::class);
}

this will redirest /login to show login form ... so we need to delete LoginViewResponse class from create function and replace return to where we want like this


 /**
* Show the login view.
*
* @param \Illuminate\Http\Request $request
* @return \Laravel\Fortify\Contracts\LoginViewResponse
*/
public function create(Request $request)
{
//return app(LoginViewResponse::class);
// engsahaly - modify login redirection
// don't forget to delete LoginViewResponse from create function
return redirect()->route('homePage');
}

 

Mahmoud Anwar

Mahmoud Anwar

Back End Developer with a passion for developing innovative web applications that expedite the efficiency and effectiveness of organizational success. Well-versed in technology and writing code to create systems that are reliable and user-friendly. Also has the proven ability to motivate, educate, and collaborate effectively to build web applications and effectively track changes. Confident communicator, strategic thinker, and innovative creator to develop software that is customized to meet a company’s organizational needs, highlight their core competencies, and further their success.