jeudi 14 avril 2022

Laravel 5.8: How to get the matched URL path without queries or parameters in the middle ware?

I'm trying to get current url in laravel without any parameters or query parameters, let's assume I've this route in the api.php file:

test/{id}/get-test-data/{type}

and the url is

test/395/get-test-data/temp

I need to log this basic url in the middle-ware test/{id}/get-test-data/{type} and not the one with parameters,

I've tried this

$route = \Route::current();
$route->uri;

it worked, but when the endpoint being hit the middle-ware print the $route->uri twice as the following

test/395/get-test-data/temp
test/{id}/get-test-data/{type}

is there any way to avoid printing the first line?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/LvOGRIS
via IFTTT

Aucun commentaire:

Enregistrer un commentaire