Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.2] Set morphs directly #5984

Merged
merged 1 commit into from
Oct 8, 2014
Merged

Conversation

JosephSilber
Copy link
Member

$post->images()->create(['path' => 'some/path.jpg']);

Currently, creating a new model off a morph relationship does not correctly set the foreign keys unless they're fillable - which I don't think they should be.

This change sets the foreign keys directly on the model, bypassing the fillable filter.


I've been bitten by this pretty harshly. I now have a whole list of records in my morph table that have no foreign key data (much thanks to MySQL "helpfully" filling them in with 0 and '').

taylorotwell added a commit that referenced this pull request Oct 8, 2014
@taylorotwell taylorotwell merged commit 42b71be into laravel:4.2 Oct 8, 2014
@JosephSilber JosephSilber deleted the direct-morphs branch December 26, 2014 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants