https://laravel.com/docs/5.7/urls
url() is global helper in laravel > 5.7
Generating Basic URLs
The url helper may be used to generate arbitrary URLs for your application. The generated URL will automatically use the scheme (HTTP or HTTPS) and host from the current request:
$post = App\Post::find(1);
echo url("/posts/{$post->id}");
// http://example.com/posts/1Accessing The Current URL
If no path is provided to the
urlhelper, aIlluminate\Routing\UrlGeneratorinstance 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
URLfacade:use Illuminate\Support\Facades\URL; echo URL::current();
No comments:
Post a Comment