Ad
Laravel, Blade Show Something If Multiple Routes Exist
I want to show edit and delete button if current route names are not (multiple routes names) I don't know if there is any other way to do this because the current I use is very complex
@if ((Route::current()->getName() != ('checkout') ) AND (Route::current()->getName() != ('checkout.payment') ) AND (Route::current()->getName() != ('checkout.addpayment') ) AND (Route::current()->getName() != ('houseaccountform') )AND (Route::current()->getName() != ('ajaxdata.tips') ))
<span class="count-number float-right">
<a target="_blank" rel="nofollow noreferrer" href="javascript:void(0);" data-id="{{$cartContent->options->product_id}}" data-editproductid="{{$cartContent->rowId}}" class="Item_root btn btn-outline-secondary btn-sm left dec editorder-edit"><i class="icofont-edit" style="font-size: 20px;"></i></a>
<button class="btn btn-outline-secondary btn-sm left dec order-item__remove" data-id="{{$cartContent->rowId}}">
<svg class="i-close" aria-labelledby="close-title" viewBox="0 0 32 32" width="32" height="32" role="img">
<title id="close-title">Delete</title>
<path fill="currentColor" d="M16 13.825l8.627-8.627 2.175 2.175-8.627 8.627 8.627 8.627-2.175 2.175-8.627-8.627-8.627 8.627-2.175-2.175 8.627-8.627-8.627-8.627 2.175-2.175z">
</path>
</svg>
</button>
</span>
@endif
Ad
Answer
You could use the in array PHP method
https://www.php.net/manual/en/function.in-array.php
@if(!in_array(Route::current()->getName(), ['checkout', 'checkout.payment']))
Include the rest of the possible routes.
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad