add policies

This commit is contained in:
nurmuhammet committed 2023-11-28 23:48:21 +05:00
1 parent 56a7255e4a
commit ede8513ebf
8 files changed
+521

No files matched your search

+20
View File
@@ -45,4 +45,24 @@ class User extends Authenticatable
'email_verified_at' => 'datetime',
'password' => 'hashed',
];
/**
* User is me?
*/
public function isMe(): bool
{
return $this->email === 'nurmuhammet@mail.com';
}
/**
* Is user admin?
*/
public function isAdmin(): bool
{
if ($this->isMe()) {
return true;
}
return $this->hasRole(['king', 'superadmin', 'admin']);
}
}