how can i save multiple checkboxes into multiple column using laravel code saved the last id in array only
@foreach ($categories as $category)
<input class="form-check-input"
type="checkbox" id="inlineCheckbox{{++$i}}"
value="{{$category->id}}"
name="ticket[]"
{{ (($order_count_normal < 200 && $category->id=="1") || ($category->id == "2" && $order_count_student < 200)) ? "" : "disabled"}}>
{{$category->category_name }} - {{ $category->price}}
@endforeach
$validatedData = $request->validate([
'ticket' => 'required_without_all',
]);// Validated user must check at least one checkbox
foreach ($validatedData['ticket'] as $value) {
$order = new Order();
$order->category_id = $value;
$order->user_id = auth()->user()->id;
$order->save();
}
i want to store in mulit column becuase each id => foreign ids in another table
thanks for reply , i will check it
please format your question correctly. put three backticks on a line before and after your code
Please sign in or create an account to participate in this conversation.