I have a menu made from
'profile' => ['heading' => 'Update your bio, cover and avatar', 'icon' => 'person', 'test' =>'test2'],
'account' => ['heading' => 'Manage your account settings', 'icon' => 'settings'],
'wallet' => ['heading' => 'Your payments & wallet', 'icon' => 'wallet'],
'payments' => ['heading' => 'Your payments & wallet', 'icon' => 'card'],
'rates' => ['heading' => 'Prices & Bundles', 'icon' => 'layers'],
Then, in blade:
<div class="d-flex align-items-center">
@include('elements.icon',['icon'=>$setting['icon'].'-outline','centered'=>'false','classes'=>'mr-3','variant'=>'medium'])
<span>{{ucfirst(__($route))}}</span>
</div>
So, how, can I , on blade, add a test to menu with name "Wallet"
I tried make some @IF but doesn’t work
2
Answers
First, you need to define the ‘test’ for ‘wallet’ in the menu array:
In this example, I added a ‘test’ key to the ‘wallet’ array with a value of ‘testValue’.
Then, in your Blade template, you can access this value like this:
Here, I’ve used an @if directive to check if the ‘test’ key is set for the current menu item ($setting). If it is, then the value of ‘test’ is displayed. If it’s not, nothing is displayed.
In your blade, when you loop through your menu items, you can check for the array key like this: