Level 3
yes u can do it. You can clean up the code
public function isAdmin() {
return $this->privilege === 1;
}
2 likes
Summer Sale! All accounts are 50% off this week.
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.