2016-07-21 14:35:23 +02:00
|
|
|
<?php namespace App\Ninja\Repositories;
|
2015-11-09 20:24:22 +01:00
|
|
|
|
|
|
|
use App\Models\Account;
|
|
|
|
|
|
|
|
class NinjaRepository
|
|
|
|
{
|
2016-07-21 14:35:23 +02:00
|
|
|
public function updatePlanDetails($clientPublicId, $data)
|
2015-11-09 20:24:22 +01:00
|
|
|
{
|
|
|
|
$account = Account::whereId($clientPublicId)->first();
|
|
|
|
|
|
|
|
if (!$account) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-04-19 04:35:18 +02:00
|
|
|
$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();
|
2015-11-09 20:24:22 +01:00
|
|
|
}
|
|
|
|
}
|