Conversation
Gummibeer
left a comment
There was a problem hiding this comment.
Couldn't this be done by the laravel internal methods!?
(new notifynder_config()->getNotifiedModel())->getKeyName()
|
@Gummibeer That doesn't address the purpose of this PR. This PR is to provide the option to set the foreign key in your own Model. |
|
@wizston and this is what this method returns. The method will return the key name of the related model - so in general |
|
@Gummibeer How would you advice in a situation where my model uses "user_id" column name instead of "id"? The the method returns the key name not set the key name. You wouldn't advice that i change my model relationship column name to id cause of the library, while there could be someone out there that communicated with some external data with any structure. I think adding it in the config would solve lots of these issues. |
|
Ok, what we need is the primary key of the other "user" model - this is by default |
…unction as suggested by @Gummibeer
|
Thanks @Gummibeer, I just adjusted the commit. |
|
Can you please fix the failed checks and in best case add an unittest for it!? |
|
https://travis-ci.org/fenos/Notifynder/jobs/232078189 Needs a review |
Option to set owner key in config for one to many relationship when polymorphic is not set to true for cases where user may have different key/table structure for their model.