From 8e348d83aa9b68fdbdfcc8ccc00b4277fb4d08d7 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Sun, 1 Jan 2017 14:54:17 +0200 Subject: [PATCH] Fix for tests --- app/Models/User.php | 5 +++++ 1 file changed, 5 insertions(+) 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) {