From fb6fd8b0844ff4265f9c905adeefe74d92ec2f2f Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 20 Dec 2023 19:53:03 +1100 Subject: [PATCH] Add helpers for paid plans --- VERSION.txt | 2 +- app/Models/Account.php | 27 +++++++++++++++++++++++++++ config/ninja.php | 4 ++-- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 432493c23c5a..f7db320c06f2 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.7.62 \ No newline at end of file +5.7.63 \ No newline at end of file diff --git a/app/Models/Account.php b/app/Models/Account.php index 439c42d80c79..81522d60beed 100644 --- a/app/Models/Account.php +++ b/app/Models/Account.php @@ -330,6 +330,33 @@ class Account extends BaseModel return $this->plan == 'enterprise'; } + public function isEnterprisePaidClient(): bool + { + if (! Ninja::isNinja()) { + return false; + } + + return $this->isEnterpriseClient() && $this->isPaid(); + } + + public function isProClient(): bool + { + if (! Ninja::isNinja()) { + return false; + } + + return $this->plan == 'pro'; + } + + public function isProPaidClient(): bool + { + if (! Ninja::isNinja()) { + return false; + } + + return $this->isProClient() && $this->isPaid(); + } + public function isTrial(): bool { if (! Ninja::isNinja()) { diff --git a/config/ninja.php b/config/ninja.php index db2b42e4ae47..aade77cb0f13 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -17,8 +17,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => env('APP_VERSION', '5.7.62'), - 'app_tag' => env('APP_TAG', '5.7.62'), + 'app_version' => env('APP_VERSION', '5.7.63'), + 'app_tag' => env('APP_TAG', '5.7.63'), 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', false),