public function store(Request $request)
{
foreach ($request->report as $key => $value) {
// do you insert here
}
}
Jan 10, 2018
8
Level 1
How to save selected checkbox value to database in laravel?
i have report table and admin_report table. in admin_report table, the admin create the report options (checkbox value) to be displayed in report form. report table is basically is for if the user report the post it will be saved in report table. so now i want to save the multiple checkbox value in array form in database. how can i create store function for that? admin_report_id is foreign key report table.
i want to save multiple checkbox value to database. How to create store controller for this ?
blade:
@foreach ($admin_report as $key => $report)
<label class="container2">
<input type="checkbox" name="report[]" value="{{$report->id}}"> {{$report-
>admin_report}}
<span class="checkmark"></span>
</label>
@endforeach
Please or to participate in this conversation.