diff --git a/src/app/Domain.php b/src/app/Domain.php --- a/src/app/Domain.php +++ b/src/app/Domain.php @@ -443,7 +443,7 @@ public function wallet(): ?Wallet { // Note: Not all domains have a entitlement/wallet - $entitlement = $this->entitlement()->withTrashed()->first(); + $entitlement = $this->entitlement()->withTrashed()->orderBy('created_at', 'desc')->first(); return $entitlement ? $entitlement->wallet : null; } diff --git a/src/app/Group.php b/src/app/Group.php --- a/src/app/Group.php +++ b/src/app/Group.php @@ -273,7 +273,7 @@ public function wallet(): ?Wallet { // Note: Not all domains have a entitlement/wallet - $entitlement = $this->entitlement()->withTrashed()->first(); + $entitlement = $this->entitlement()->withTrashed()->orderBy('created_at', 'desc')->first(); return $entitlement ? $entitlement->wallet : null; } diff --git a/src/app/OpenVidu/RoomSetting.php b/src/app/OpenVidu/RoomSetting.php --- a/src/app/OpenVidu/RoomSetting.php +++ b/src/app/OpenVidu/RoomSetting.php @@ -21,16 +21,12 @@ protected $table = 'openvidu_room_settings'; /** - * The user to which this setting belongs. + * The room to which this setting belongs. * * @return \Illuminate\Database\Eloquent\Relations\BelongsTo */ public function room() { - return $this->belongsTo( - '\App\OpenVidu\Room', - 'room_id', /* local */ - 'id' /* remote */ - ); + return $this->belongsTo('\App\OpenVidu\Room', 'room_id', 'id'); } } diff --git a/src/app/Payment.php b/src/app/Payment.php --- a/src/app/Payment.php +++ b/src/app/Payment.php @@ -52,10 +52,6 @@ */ public function wallet() { - return $this->belongsTo( - '\App\Wallet', - 'wallet_id', /* local */ - 'id' /* remote */ - ); + return $this->belongsTo('\App\Wallet', 'wallet_id', 'id'); } } diff --git a/src/app/User.php b/src/app/User.php --- a/src/app/User.php +++ b/src/app/User.php @@ -634,7 +634,7 @@ */ public function wallet(): ?Wallet { - $entitlement = $this->entitlement()->withTrashed()->first(); + $entitlement = $this->entitlement()->withTrashed()->orderBy('created_at', 'desc')->first(); // TODO: No entitlement should not happen, but in tests we have // such cases, so we fallback to the user's wallet in this case diff --git a/src/app/UserAlias.php b/src/app/UserAlias.php --- a/src/app/UserAlias.php +++ b/src/app/UserAlias.php @@ -24,10 +24,6 @@ */ public function user() { - return $this->belongsTo( - '\App\User', - 'user_id', /* local */ - 'id' /* remote */ - ); + return $this->belongsTo('\App\User', 'user_id', 'id'); } } diff --git a/src/app/UserSetting.php b/src/app/UserSetting.php --- a/src/app/UserSetting.php +++ b/src/app/UserSetting.php @@ -25,10 +25,6 @@ */ public function user() { - return $this->belongsTo( - '\App\User', - 'user_id', /* local */ - 'id' /* remote */ - ); + return $this->belongsTo('\App\User', 'user_id', 'id'); } } diff --git a/src/app/WalletSetting.php b/src/app/WalletSetting.php --- a/src/app/WalletSetting.php +++ b/src/app/WalletSetting.php @@ -25,10 +25,6 @@ */ public function wallet() { - return $this->belongsTo( - '\App\Wallet', - 'wallet_id', /* local */ - 'id' /* remote */ - ); + return $this->belongsTo('\App\Wallet', 'wallet_id', 'id'); } }