mirror of
https://github.com/ershisan99/coolify.git
synced 2025-12-17 12:33:06 +00:00
Refactor User model role() method to use data_get() for better readability
This commit is contained in:
@@ -183,6 +183,7 @@ class User extends Authenticatable implements SendsEmail
|
|||||||
if (data_get($this, 'pivot')) {
|
if (data_get($this, 'pivot')) {
|
||||||
return $this->pivot->role;
|
return $this->pivot->role;
|
||||||
}
|
}
|
||||||
return auth()->user()->teams->where('id', currentTeam()->id)->first()->pivot->role;
|
$user = auth()->user()->teams->where('id', currentTeam()->id)->first();
|
||||||
|
return data_get($user, 'pivot.role');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user