Unconventional, yes. Unsafe, no.
What prevents you organising this data in a Controller, or View Composer?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi, by necessity I find myself having to implement model references in portions of layouts. I wanted to know if using this (example) directly in the blade file:
@inject('totalItems', 'App\Models\Items')
{{ $totalItems->where('status', 1)->count() }}
Is it a "safe" method?
Please or to participate in this conversation.