Laravel Blade Issue

- 1 answer

I am upgrading a laravel site from 5.6 to 5.8. I have some forms where it will set the input value to something if the variable is available else it will leave it blank similar to below. This was working fine on 5.6 but when I try it with 5.8 for every instance of this it shows a value of 1. Even if I put something like or 'Joe' it still ends up putting 1 there. If I remove the or '' it will work just fine and display what is sent over for $data->name.

{{ $data->name or '' }} 

Just curious if anyone has seen this behavior as I have not. If I dd $data in the controller or the blade template the data is as expected and not just full of 1's.




Laravel or operator was changed in laravel 5.7 to ??.

The Blade "or" operator has been removed in favor of PHP's built-in ?? "null coalesce" operator, which has the same purpose and functionality

So {{ $data->name or '' }} is now {{ $data->name ?? '' }}