From 974a224300c62340b91f9e5d5b09323aa69dcd2a Mon Sep 17 00:00:00 2001 From: Mohamed Kawsara Date: Tue, 10 Oct 2017 06:01:16 +0300 Subject: [PATCH] Fix user relation while maintaining older verions There is another approach which is using `app()->version()` however I didn't want to go throw strings manipulation to figure it out! --- src/Rateable/Rating.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Rateable/Rating.php b/src/Rateable/Rating.php index 1984cdb..c0bb54a 100644 --- a/src/Rateable/Rating.php +++ b/src/Rateable/Rating.php @@ -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); } }