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

It's not fundamentally different, but using array_map gives you a cleaner syntax:

$ids = Input::get('some_id');
$status = Input::get('status');

$modelData = array_map($ids, function($id) use($status)
{
    return array(
        'some_id' => $id,
        'status' => $status
    );
});
SomeModel::create($modelData);
Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

extjac extjac Joined 14 Feb 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.