diff options
Diffstat (limited to 'app/Models/User.php')
| -rwxr-xr-x | app/Models/User.php | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/Models/User.php b/app/Models/User.php index 4aeaf21..b025bbe 100755 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -48,6 +48,7 @@ class User extends Authenticatable 'email_verified_at' => 'datetime', 'password' => 'hashed', 'status_updated_at' => 'datetime', + 'role' => 'integer' ]; } @@ -65,12 +66,17 @@ class User extends Authenticatable return $this->hasMany(Link::class); } + public function isAdmin(): bool + { + return $this->role == 0; + } + public function getStorageQuota(){ - $roles = $this->roles(); + $roles = $this->roles()->get(); $quota = 0; foreach ($roles as $r){ - if ($role->storage_quota > $quota){ - $quota = $role->storage_quota; + if ($r->storage_quota > $quota){ + $quota = $r->storage_quota; } } return $quota; |
