Getting Current Route Name : Laravel

'Request URI' retrieve කිරීම සඳහා විවිධ ක්‍රම ඇතත් ඒවා ක්‍රියාත්මක කිරීම, විවිධ තත්ත්ව සහ කොන්දේසි මත සිදු වේ.

Route Facadeක භාවිතයෙන්:

Laravel Version 6 සිට මෙම පහසුකම භාවිත කළ හැක.

use Illuminate\Support\Facades\Route;

$route = Route::current(); // Illuminate\Routing\Route
$name = Route::currentRouteName(); // string
$action = Route::currentRouteAction(); // string

menu_book Documentation: Accessing the Current Route

The following returns URL instead of route name

url()->current();

Imagine, we have menu icon, that changes according to the menu currently we are.

Electrical Epquipment Furnitures Products

<li class="
  {{ (Request::is('products/*') || Request::is('products') || Request::is('product/*') ? 'active' : '')
  }} ">
  <a href="{{url('products')}}">
    <i class="fa fa-code-fork"></i>
    &nbsp; Products
  </a>
</li>

Popular posts from this blog

Evolution of computers and Computers today

Convert into binary

Processor Types and Specifications