Level 102
You shouldn't use conditions inside config files. They are meant to be cached to a static value. Conditional logic goes in the rest of your files
2 likes
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi devs, I just need to know how to use conditional statement inside a config file of livewire.
inside config/livewire.php I want to define condition which depends on request.
'layout' => request()->is('/admin') ? 'layouts.admin' : 'layouts.client',
All this inside an array.
You shouldn't use conditions inside config files. They are meant to be cached to a static value. Conditional logic goes in the rest of your files
Please or to participate in this conversation.