When I am developing locally on win10 php7.2 nginx expression like this works just fine
<div class="{{ $menuclass or 'menu'}}">
which gives
<div class="menu">
but as soon as I deploy it via laravel forge to ubuntu machine it fails to work and I get this
<div class="1">
It seems that instead of doing this:
isset($menuclass ) ? $menuclass : 'menu'
it just returns 1
Any ideas why?
This feature was blogged about here: https://laravel-news.com/blade-or-operator
Has it been deprecated in later versions of laravel?
Laravel or operator was changed in laravel 5.7 to ??
The or Operator Likelihood Of Impact: High
The Blade "or" operator has been removed in favor of PHP's built-in ?? "null coalesce" operator, which has the same purpose and functionality:
try this:
<div class="{{ $menuclass ?? 'menu'}}">
here is the upgrade guide.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With