I am working on a Laravel project, and I need to hide a specific button in the admin panel. The button is located in a Blade file that looks like this:
<td>
<button class="btn btn-primary action" data-href="{{ route('credit-card-accept', $bill->id) }}">
<i class="fa fa-pen"></i>
</button>
</td>
I want to hide this button entirely, but only for certain cases (e.g., when a specific condition is met). How can I do this? I’ve tried wrapping it in an @if statement, but I’m not sure how to properly implement this in Blade.
@if(false)
<button>...</button>
@endif
But this hardcodes the button to always hide.
What I need: A dynamic solution to hide the button based on conditions in the controller or model.
New contributor
Reda HAMIDI is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.