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

Are you using the create() method for the athletes and forgot to include client_id in the $fillable by any chance?

0

Yes, that worked! Thank you! I waited over a week for help in the Laracasts forum and now here with no response until you came along!

I didn't include client_id because I thought the $fillable array was just for fields where there was a risk of a user inserting something bad, but client_id came from a pre-populated dropdown.

To be safe, should I always include all fields except id and the default timestamps?

0

It really depends how you use it. The $fillable array only marks the values that can be populated by mass-assignment through methods like create() and update(). If you want to be on the safe side you can always set values manually on the object but for large data objects this can be quite a lot of work.

So the decision is basically between safety and comfort - to which degree you use each one is up to you. :)

0

Sign in to participate in this thread!

Eventy

Your banner here too?

webmachine webmachine Joined 31 Mar 2015

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.