diff --git a/app/Models/User.php b/app/Models/User.php index f4e49a259ae3..9ba3db5d2b77 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -395,6 +395,11 @@ class User extends Authenticatable return (($entity && $this->can('edit', $entity)) || (!$entity && $this->can('create', $entityType))); } + + public function primaryAccount() + { + return $this->account->company->accounts->sortBy('id')->first(); + } } User::updating(function ($user) {