Skip to content

Conversation

@sileence
Copy link
Contributor

This PR adds the default option for morph one relations.

I also moved the logic to a trait to avoid code duplication. The only difference between morphOne, hasOne and belongsTo was the code to create the related instance, so I extracted that to an abstract method. So in order to implement the withDefault feature in a relation, you need to include the trait HasDefault and then implement the newRelatedInstanceFor method. I hope this makes sense.

@sileence
Copy link
Contributor Author

cc @browner12 @decadence

@decadence
Copy link
Contributor

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants