Reputation: 1609
When trying to get page url with
URL::current();
it's ignore the pagination. For example:
current url is www.google.com/searc?page=2
dd(URL::current());
gives us www.google.com/search
. Using default pagination.
My question is: Any function for get url with paginations?
Upvotes: 1
Views: 86
Reputation: 5608
Simply use :
\URL::full();
It will give the url along with query string.
Upvotes: 2
Reputation: 1556
As described in the docs of Laraval. You can use URL::full()
Accessing The Current URL
If no path is provided to the url helper, a Illuminate\Routing\UrlGenerator instance is returned, allowing you to access information about the current URL:
// Get the current URL without the query string...
echo url()->current();
// Get the current URL including the query string...
echo url()->full();
// Get the full URL for the previous request...
echo url()->previous();
Each of these methods may also be accessed via the URL facade:
use Illuminate\Support\Facades\URL;
echo URL::current();
Upvotes: 1
Reputation: 538
You will need the full URL, not just the URL. Try this:
\URL::full();
Upvotes: 1