Level 54
what does the rest of the error say?
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
i have this eloquent code
$payaments=Equipment::where('vehicle_id',$id)->pluck('equipment_value');
when make return $payaments its return the following array
[
"payment_method_types_pay1",
"payment_method_types_pay2",
"payment_method_types_pay3",
"payment_method_types_pay4",
"ext_int_sunroof_norm",
"ext_int_furniture_leat",
]
in blade i want to check if value in_array checkbox must be checked
<input type="checkbox" name="payament_method" @if(in_array('payment_method_types_pay1',$payaments)) checked @endif>
but i got error
in_array(): Argument #2 ($haystack) must be of type array, I
pluck method return a collection, which is not an array.
So
$payaments = Equipment::where('vehicle_id', $id)->pluck('equipment_value')->toArray();
or instead of in_array use contains method.
Please or to participate in this conversation.