Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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

get full current url 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 current route url

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

PREVIOUS NEXT
Code Example
Php :: php days remaining 
Php :: how to know the path of php in linux 
Php :: refresh a specific migration laravel 
Php :: PHP Simple HTML DOM 
Php :: php sort reverse 
Php :: laravel blade upper case 
Php :: php token generator 
Php :: setinterval php 
Php :: laravel hasmany count 
Php :: linux delete php sessions 
Php :: convert multidimensional array to single array php 
Php :: symfony server start port 
Php :: session variable in laravel 
Php :: increase memory limit wordpress 
Php :: how to check php version in php 
Php :: check current pages is a child page wordpress 
Php :: get current month records in laravel 
Php :: laravel cron job on shared hosting 
Php :: symfony datetime now 
Php :: mpdf output 
Php :: how to find total rows fetched php pdo 
Php :: php check if headers already sent 
Php :: how to get yesterday date in laravel 
Php :: start someones laravel project 
Php :: cakephp 2.x join 
Php :: php array filter only null 
Php :: laravel file permissions 
Php :: php return json data to ajax 
Php :: no privileges to create databases phpmyadmin 
Php :: Sending Data over another website via PHP 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =