Why does role id == "13","0" evaluate to false when role id is set to "13","0"?

Viewed 38

how can i make role id equals 2 value I don't know what to do When I use this code it doesn't work

@if($lead->role_id == '13','0')
1 Answers

To check if some records role ID is equal to one of several ID's, in a Blade template you can do the following:

@if(in_array($lead->role_id, [13, 0]))
    ...
@endif

It's unlikely that your ID's are going to be stored as strings, but if for some reason they are, you can just wrap the numbers in ' or ".

Related