How to get relative urls with url () in Laravel 5.2?

I did a search and can't find anything that solves this in Laravel 5.2.

Is it possible to generate relative URLs in Laravel 5.2?

Is the value instead http://example.com/mypageeasy /mypage?

+4
source share
2 answers

Yes, you must use $request->path(), it will return URI.

+6
source

If you are trying to generate them, rather than retrieving the current one, you can pass the third parameter to the function route.

echo route('about', [], false);

If you pass true(by default) as the third parameter, it will give you

http://example.com/about

false ,

/

+4

Source: https://habr.com/ru/post/1629440/


All Articles