2017-01-30 20:40:43 +01: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();
|
|
|
|
|
2017-01-30 20:40:43 +01:00
|
|
|
if (! $account) {
|
2015-11-09 20:24:22 +01:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-04-19 04:35:18 +02:00
|
|
|
$company = $account->company;
|
2017-05-08 10:18:35 +02:00
|
|
|
$company->fill($data);
|
2018-03-16 11:15:16 +01:00
|
|
|
$company->plan_expires = $company->plan_expires ?: null;
|
2016-04-19 04:35:18 +02:00
|
|
|
$company->save();
|
2015-11-09 20:24:22 +01:00
|
|
|
}
|
|
|
|
}
|