public function canAccessPanel(Panel $panel): bool
{
//if panel is admin, only saas employees can access
if($panel->getId() === 'admin'){
return $this->canAccessAdminPanel();
}elseif ($panel->getId() === 'company') {
return $this->canAccessCompanyPanel();
}
return false;
}
public function canAccessAdminPanel(): bool
{
return $this->isSaasEmployee();
}
public function canAccessCompanyPanel(): bool
{
// Check if user is a SAAS employee
if ($this->isSaasEmployee()) {
return true;
}
// Check if user is associated with any companies
if ($this->companies()->exists()) {
return true;
}
return false;
public function canAccessPanel(Panel $panel): bool
{
//if panel is admin, only saas employees can access
if($panel->getId() === 'admin'){
return $this->canAccessAdminPanel();
}elseif ($panel->getId() === 'company') {
return $this->canAccessCompanyPanel();
}
return false;
}
public function canAccessAdminPanel(): bool
{
return $this->isSaasEmployee();
}
public function canAccessCompanyPanel(): bool
{
// Check if user is a SAAS employee
if ($this->isSaasEmployee()) {
return true;
}
// Check if user is associated with any companies
if ($this->companies()->exists()) {
return true;
}
return false;