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

everything looks ok to me, mmm try to create a survey like this:

    $survey = new Survey();
    $survey->name = 'Name';
    $user->surveys()->save( $survey );

dd( $surver->user_id );
Last updated 1 year ago.
0

Thanks for your reply. Still null though, both in the DB and in the dd output

Last updated 1 year ago.
0

If I dd( $user->Id ); I get int 2. I am using L41.

Last updated 1 year ago.
0

i just note the "I" char in "Id" capitalized, is that a typo??

Last updated 1 year ago.
0

This is it! The field was actually also capitalized in the database. That was not an issue for inserting data, but for the relationship eloquent apparently calls for lower case field names.

Thank you so much for your help man.

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

wirk wirk Joined 2 Mar 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.