Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

how get url in laravel

// 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();
Comment

how to get current url path in laravel

// Full URL with query string
print $request->fullUrl(); // http://127.0.0.1:8000/sometext?city=hyd

// Get the path part of the URL 
print $request->path(); // sometext

// Root (protocol and domain) part of the URL)
print $request->root(); //http://127.0.0.1:8000

//Get the full URL for the previous request
print url()->previous();

//tested on Laravel 5.6

//OR 

use IlluminateSupportFacadesURL;
 
print URL::current();
Comment

laravel get url path

$currentURL = URL::current(); PHP.
$url = URL::to("/"); or use $url = url('/'); PHP.
$route = Route::current()->getName(); PHP.
$prefix = Request::route()->getPrefix(); PHP.
Comment

get current url in controller in laravel

//get current url
use IlluminateSupportFacadesRoute;
Route::getFacadeRoot()->current()->uri();
//get current full url
$url = url()->current();
Comment

Laravel get url

Example 1: current() with Helper

$currentURL = url()->current();
  
dd($currentURL);
Example 2: full() with Helper(with query string parameters)

$currentURL = url()->full();
    
dd($currentURL);
Example 3: current() with Facade

$currentURL = URL::current();
    
dd($currentURL);
Example 4: full() with Facade(with query string parameters)

$currentURL = URL::full();
    
dd($currentURL);
Example 5: using Request

$currentURL = Request::url();
  
dd($currentURL);
Get Previous URL in Laravel:

$url = url()->previous();
  
dd($url);
Get Current Route in Laravel:


$route = Route::current()->getName();
  
dd($route);
Comment

laravel current url

use IlluminateSupportFacadesURL;
 
echo URL::current();
Comment

laravel get current route url

@if(Request::url() === 'your url here')
    // code
@endif
Comment

laravel get a url using name

$url = route('routeName');

//if there is a param:
$url = route('routeName', ['id' => 1]);

https://laravel.com/docs/5.1/helpers#method-route
Comment

laravel get old url

str_replace(url('/'), '', url()->previous())
Comment

laravel get current route url

if (Request::is('admin/*'))
{
    // code
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: git change remote origin 
Html :: favicon meta 
Html :: opem link in new tab html 
Html :: html 5 default code 
Html :: font-awesome envelope 
Html :: starter data jpa maven dependency 
Html :: boostrap row reverse utility 
Html :: html include jquery 
Html :: accept only image input file 
Html :: open phone from anchor tag 
Html :: bootstrap Bootstrap link 
Html :: #ubuntu "demarrer vcs en super user" 
Html :: jquery $ is not defined 
Html :: fa icons profile 
Html :: how to import taglib 
Html :: accepts only audio file in html 
Html :: html entities for space 
Html :: how to link to an email in html 
Html :: html phone 
Html :: adding mp4 in html 
Html :: embed string html angular 
Html :: how to embed videos in html 
Html :: Change the required text 
Html :: bootstarp btn colors 
Html :: How to install sweetalert2 with CDN? 
Html :: include favicon html 
Html :: how to set link as normal text in html 
Html :: bootstrap buttons Sizes 
Html :: how to add placeholder in type date 
Html :: how to remove options for video tag in html 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =