I don't get it why you want to use regular expressions here. If I understood your problem correctly, you can do something like this:
if (Input::has('item_id')) {
$items = array_map(
function($id) {
return Item::findOrFail($id);
},
Input::get('item_id')
);
$checklist->items()->saveMany($items);
}
Of course I assume that you have your saved checklist in $checklist
variable before this block.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community