Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get fullUrl in laravel 5.1

i have multiple bootstrap tabs where each one do different action from others tabs for exmaple

app-url/users#creat-admin-users-tab app-url/users#creat-regular-users-tab

Is there any way in Laravel to get full url including the #tab-name

Thanks for your time.

like image 488
Muhammad Atallah Avatar asked Nov 13 '15 07:11

Muhammad Atallah


People also ask

How do I get params in laravel?

Method 1: $request->route('parameter_name') We can access route parameters in two ways. One way is by using $request->route('parameter_name') ., where parameter_name refers to what we called the parameter in the route.

How can you retrieve the full URL for the incoming request laravel?

The “path” method is used to retrieve the requested URI. The is method is used to retrieve the requested URI which matches the particular pattern specified in the argument of the method. To get the full URL, we can use the url method.


1 Answers

Laravel has functionality to return you the current url. It is all specified in this page: http://laravel.com/api/5.0/Illuminate/Http/Request.html

What you are looking for is Request::fullUrl().

Let's say I'm on http://laravel.dev/test?test=1, here are the methods and the results:

Request::fullUrl() // Returns: http://laravel.dev/test?test=1 Request::url() // Returns: http://laravel.dev/test Request::path() // Returns: test Request::root() // Returns: http://laravel.dev  
like image 52
Andrius Avatar answered Sep 21 '22 20:09

Andrius