Support the ongoing development of Laravel.io →
Eloquent Views Forms
Last updated 1 year ago.
0

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.

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Gillko gillko Joined 21 Aug 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.