Customize redirect after admin panel login

Jun 5, 2022
Admin panel

Create a LoginResponse class in App\Http\Responses namespace.

The content of the class should be :

namespace App\Http\Responses;
use Filament\Http\Responses\Auth\Contracts\LoginResponse as LoginResponseContract;
class LoginResponse implements LoginResponseContract
* Create an HTTP response that represents the object.
* @param \Illuminate\Http\Request $request
* @return \Symfony\Component\HttpFoundation\Response
public function toResponse($request)
// return whatever you want as url
$url = 'blabla';
return redirect()->intended($url);

then add in your service provider.

use Filament\Http\Responses\Auth\Contracts\LoginResponse as LoginResponseContract;
// ....
$this->app->bind(LoginResponseContract::class, \App\Http\Responses\LoginResponse::class);

I tried this tips, but nothing happens. ray() confirms me that the code suggested by Shipu Ahamed is read in the boot() function of App\Service\Provider, but the call is not made in the first LoginResponse file. I'm pretty new with Laravel. There is something I don't understand certainly. My goal with that is that I want certain registered users not directed to the admin but to a specific page.


Works, but it is worth mentioning that code provided by @Shipu Ahamed should be placed in RouteServiceProvider, not in AppServiceProvider.


for keeping the logic. We could, I presume, create our own provider to separate what belongs to a specific app.