How to Get Current URL And site URL in laravel

Current URL in Laravel

Laravel provide URL facade that way we can get current URL.

$currentURL = URL::current();
PHP

 

SIte URL in Laravel

$url = URL::to("/");

or use

$url = url('/');
PHP

 

Get current route name in laravel

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

 

Get current route prefix name in laravel

$prefix = Request::route()->getPrefix();
PHP

 

Popular posts from this blog

Yii Framework In Update Time View Image In Form

Add a new column to existing table in a migration

Ajax Toggle(on/off) on-click Update