I am passing a variable that may be null value from controller to blade
When this variable is of a null value it causes an error in the following line where it says unexpected token,
'client_id': {{$current_client}},
Whats the correct syntax for this situation?
CodePudding user response:
Wrap this in back ticks i.e.
'client_id': `{{$current_client}}`
if there's a null value, it'll return empty not an error.
CodePudding user response:
Wrap the code in a single quote,
'client_id': '{{ $client_id }}'

