From 2853351ca2e038d42063b4c5cad44b399ec69dde Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 14 May 2018 20:12:25 +0300 Subject: [PATCH] Support filtering email notifications --- app/Models/Account.php | 5 +++++ resources/views/accounts/partials/notifications.blade.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Models/Account.php b/app/Models/Account.php index ce8622855b77..6e2644ea05e0 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -1797,6 +1797,11 @@ class Account extends Eloquent return $this->company->accounts->count() > 1; } + public function hasMultipleUsers() + { + return $this->users->count() > 1; + } + public function getPrimaryAccount() { return $this->company->accounts()->orderBy('id')->first(); diff --git a/resources/views/accounts/partials/notifications.blade.php b/resources/views/accounts/partials/notifications.blade.php index 018fcde8f29a..2e401dfb6b86 100644 --- a/resources/views/accounts/partials/notifications.blade.php +++ b/resources/views/accounts/partials/notifications.blade.php @@ -14,7 +14,7 @@ {!! Former::checkbox('notify_paid')->label(' ')->text(trans('texts.email_paid'))->value(1) !!} {!! Former::checkbox('notify_approved')->label(' ')->text(trans('texts.email_approved'))->value(1) !!} - @if (true || Auth()->user()->account->users->count() > 1) + @if (Auth()->user()->account->hasMultipleUsers())
{!! Former::radios('only_notify_owned')->radios([ trans('texts.all_invoices') => array('name' => 'only_notify_owned', 'value' => 0),