The following code iterate over a variable product and displays it in a table. I want it to be that if the is_active attribute of the product is false, then it won't be displayed in the table. How can I make this happen ? Below are the code :
You need to conditionally render the div. It looks like you are using Blade components?
The easiest way of doing this in Blade components would be to install & use alpineJS.
Follow these step to set it up.
Install alpineJS in the terminal run the command:
npm install alpinejs
in your controller add this line to the method that you want to activate the div.
session()->flash('is_active');
In your blade component wrap the entire div in the following code:
@if (session()->has('is_set'))
<div x-data="{ show: true }" x-show="show">
// your data here
</div>
@endif