Does anyone know how to override the Router in Laravel 10. I tried by creating a class and extends the Routers and added some custom functions. And in the RouteServiceProvider boot that new Route Service using singleton. But it didn't worked.
If you just want to add a custom function, you can do it with macro.
// AppServiceProvider
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
public function boot(): void
{
Route::macro('custom', function () {
//
});
}