Skip to content

Commit

Permalink
Fix user relation while maintaining older verions
Browse files Browse the repository at this point in the history
There is another approach which is using `app()->version()` however I didn't want to go throw strings manipulation to figure it out!
  • Loading branch information
mkwsra authored Oct 10, 2017
1 parent 6f261bf commit 974a224
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Rateable/Rating.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ public function rateable()
*/
public function user()
{
return $this->belongsTo(Config::get('auth.providers.users.model'));
$userClassName = Config::get('auth.model');
if (is_null($userClassName)) {
$userClassName = Config::get('auth.providers.users.model');
}

return $this->belongsTo($userClassName);
}
}

1 comment on commit 974a224

@willvincent
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a good solution, thanks

Please sign in to comment.