diff --git a/app/Exceptions/AccountLimitException.php b/app/Exceptions/AccountLimitException.php new file mode 100644 index 00000000000..cd6f0f2e90a --- /dev/null +++ b/app/Exceptions/AccountLimitException.php @@ -0,0 +1,12 @@ +validate($data); + $account = Account::find($data['account_id']); + if (AccountHelper::hasReachedContactLimit($account) + && AccountHelper::hasLimitations($account) + && ! $account->legacy_free_plan_unlimited_contacts) { + throw new AccountLimitException(); + } + // filter out the data that shall not be updated here $dataOnly = Arr::except( $data,