Example of getting route name and path in Laravel 8
request()->getRequestUri();
//raw path info after domain and protocal in uri
request()->getPathInfo();
//trim the slash "/" inside uri
request()->path();
//check route name w/o group
request()->is('licenses');
//get and check route name
request()->route()->named('licenses.index')
//get first segment of path url
request()->segments()[0]
Example of Use :
No comments:
Post a Comment