mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-14 07:02:34 +01:00
22f65e8108
* Allow admins to change plan * Check features instead of plans * Support linking/unlinking accounts * Support creating/deleting accounts
25 lines
810 B
PHP
25 lines
810 B
PHP
<?php namespace App\Ninja\Repositories;
|
|
|
|
use App\Models\Account;
|
|
|
|
class NinjaRepository
|
|
{
|
|
public function updatePlanDetails($clientPublicId, $data)
|
|
{
|
|
$account = Account::whereId($clientPublicId)->first();
|
|
|
|
if (!$account) {
|
|
return;
|
|
}
|
|
|
|
$company = $account->company;
|
|
$company->plan = !empty($data['plan']) && $data['plan'] != PLAN_FREE?$data['plan']:null;
|
|
$company->plan_term = !empty($data['plan_term'])?$data['plan_term']:null;
|
|
$company->plan_paid = !empty($data['plan_paid'])?$data['plan_paid']:null;
|
|
$company->plan_started = !empty($data['plan_started'])?$data['plan_started']:null;
|
|
$company->plan_expires = !empty($data['plan_expires'])?$data['plan_expires']:null;
|
|
|
|
$company->save();
|
|
}
|
|
}
|