I have tried adding this code to my Blade:
@if(!empty($user_wallet))
<li class="mt-3" id="theWallet">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="pay_wallet" value="1" id="thisWrapper">
<label class="form-check-label small mr-3" for="thisWrapper">
Pay with Wallet
</label>
</div>
</li>
@endif
So this means, if user has not any Wallet, do not show the div with id of theWallet.
But now the problem is, it still shows the div and checkbox however the user does not have any Wallet stored at the DB.
And when I dd($user_wallet), I get this:
Illuminate\Database\Eloquent\Collection {#2562 ▼
#items: []
}
Meaning that, it's empty. But why it still shows the div?