Search code examples
phplaravel-8laravel-fortify

How to overwrite laravel fortify controllers


I need to overwrite the login,register,logout and 2FA methods to add some logic, How can i publish it from the vendor?, is there something like php artisan vendor:publish .....


Solution

  • I find that i can overwrite any of fortify pipeline in FortifyServiceProvider by adding the flowing inside boot() function:

    # overwrite example
    $this->app->singleton(LoginResponseContract::class, LoginResponse::class);
    $this->app->singleton(RegisterResponseContract::class, RegisterResponse::class);
    .
    .
    .