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

Master branch of laravel/framework is 5.3. Master branch of laravel/laravel is 5.2.

If you already have an instance of a model that you are filling, you would call save. Create is creating a new model based on attributes passed in and returning a new model. Since you never saved the model you have assigned to $platform it has no id attribute.

0

you are correct on the 5.2. Thanks.

The instance method create takes the values as well. That's the way I originally had this code; as that's what the docs said to do. That also does not return an id. That should probably be removed and just leave the static method, or fix it to return the id.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

kireol kireol Joined 22 Mar 2016

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.