Level 104
Why is it an "array checkbox" exactly? And what is $request->field?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I have a checkbox with name of currently_studying. But I did not successfully.
foreach ($request->field as $key => $value) {
$educational = new Educational;
$educational->user_id = auth()->id();
$educational->grade_id = $request->grade_id[$key];
$educational->field = $request->field[$key];
$educational->institution_id = $request->institution_id[$key];
$educational->branch = $request->branch[$key];
$educational->institution_education = $request->institution_education[$key];
$educational->gpa = $request->gpa[$key];
$educational->country_id = $request->country_id[$key];
$educational->state_id = $request->state_id[$key];
$educational->city_id = $request->city_id[$key];
$educational->state_name = $request->state_name[$key];
$educational->city_name = $request->city_name[$key];
$educational->entrance = $request->entrance[$key];
$educational->graduate = $request->graduate[$key];
$educational->currently_studying = $request->has('currently_studying')[$key];
$educational->save();
}
$educational->currently_studying = $request->has("currently_studying.$key");
Please or to participate in this conversation.