/** * Checks if the current user may edit the brand * * @param User $user * @return bool */ public function mayEdit(User $user) { $account = $user->account; // System admin may always edit if ($account->isSystemAccount() && $user->hasRole('admin')) { return true; } if ($account->brand->id == $this->id && $user->hasRole('admin')) { return true; } else { return false; } }