Lars-Janssen
2 years ago

Save multiple records

Posted 2 years ago by Lars-Janssen

Hey,

Right now I save multiple records like this:

public function saveOptions(Request $request)
    {
        $options = $request->options;
        foreach ($options as $key => $value) {
            $options[$key]['poll_id'] = $this->id;
            Option::create($options[$key]);
        }
    }

Is there a better way?

Please sign in or create an account to participate in this conversation.