Level 3
yes u can do it. You can clean up the code
public function isAdmin() {
return $this->privilege === 1;
}
2 likes
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
just looking for best practice for this stuff
class User extends Authenticatable
{
public function isAdmin() {
if($this->privilege === 1) {
return true;
}
return false;
}
public function isOwner() {
if($this->privilege === 2) {
return true;
}
return false;
}
public function isCustomer() {
if($this->privilege === 3) {
return true;
}
return false;
}
}
something like this
Please or to participate in this conversation.