@littledaggers It would probably be better just to show the badge only if your conditions are met:
@if($conditionsAreMet)
<!-- New alerts badge mark-up here -->
@endif
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I want to display a badge by removing the hidden attribute when a certain condition is met. This condition is when 1 or more of 3 data queries have entries that meet the query conditions.
the badge code is as follows:
</div>
<span class="position-absolute top-0 start-100 translate-middle p-2 bg-danger border border-light rounded-circle badge badge-pill badge-danger" id="new-notification" hidden>
<span class="visually-hidden">New alerts</span>
</span>
</div>
I want to display it by removing the hidden attribute when these queries in the controller have entries that meet the conditions:
$quot_one = ClientQuotation::where('verified_receipt', '0')->whereDate('created_at', '=', Carbon::yesterday())->get();
$quot_seven = ClientQuotation::where('validated_7', '0')->whereDate('created_at', '=', Carbon::today()->subDays(7))->get();
$follow_today = QuotationFollowup::whereDate('date', '=', Carbon::today())->where('done', '0')->get();
I cannot think of a way to do it. Since the conditions are server side and the badge is client side. This is an issue I am facing as entry level web developer. Could anyone give me some insight on how to approach this situation? Thank you in advance
@littledaggers It would probably be better just to show the badge only if your conditions are met:
@if($conditionsAreMet)
<!-- New alerts badge mark-up here -->
@endif
Please or to participate in this conversation.