2019-06-17 02:15:42 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2020-01-07 01:13:47 +01:00
|
|
|
* @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-06-17 02:15:42 +02:00
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Factory;
|
|
|
|
|
|
|
|
use App\DataMapper\CompanySettings;
|
|
|
|
use App\Models\Company;
|
|
|
|
use App\Utils\Traits\MakesHash;
|
|
|
|
|
|
|
|
class CompanyFactory
|
|
|
|
{
|
2019-12-30 22:59:12 +01:00
|
|
|
use MakesHash;
|
2019-06-17 02:15:42 +02:00
|
|
|
|
2019-12-07 12:33:49 +01:00
|
|
|
/**
|
|
|
|
* @param int $account_id
|
|
|
|
* @return Company
|
|
|
|
*/
|
|
|
|
public function create(int $account_id) :Company
|
2019-12-30 22:59:12 +01:00
|
|
|
{
|
2019-06-17 02:15:42 +02:00
|
|
|
$company = new Company;
|
2019-12-07 12:33:49 +01:00
|
|
|
// $company->name = '';
|
2019-06-17 02:15:42 +02:00
|
|
|
$company->account_id = $account_id;
|
|
|
|
$company->company_key = $this->createHash();
|
2019-09-19 07:50:05 +02:00
|
|
|
$company->settings = CompanySettings::defaults();
|
2019-06-17 02:15:42 +02:00
|
|
|
$company->db = config('database.default');
|
2020-02-10 10:53:02 +01:00
|
|
|
//$company->custom_fields = (object) ['invoice1' => '1', 'invoice2' => '2', 'client1'=>'3'];
|
|
|
|
$company->custom_fields = (object) [];
|
2019-12-10 21:53:41 +01:00
|
|
|
$company->subdomain = '';
|
2020-07-24 00:00:28 +02:00
|
|
|
$company->enabled_modules = config('ninja.enabled_modules'); //32767;//8191; //4095
|
2019-12-07 12:33:49 +01:00
|
|
|
|
2019-06-17 02:15:42 +02:00
|
|
|
return $company;
|
|
|
|
}
|
2019-12-07 12:33:49 +01:00
|
|
|
}
|