Support the ongoing development of Laravel.io →
posted 10 years ago
Eloquent
Last updated 2 years ago.
0

Normally when you use create it is because you are creating more than one model and passing in an array.... Is that the case with what you are doing?

Is $fields an array?

0

You don't need to create a new instance of the model, just call the create method directly. I've tried the following and it worked successfully.

$page = Page::create($fields);
dd($page->id);
Last updated 10 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Donny5300 donny5300 Joined 3 May 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.