2019-06-17 02:15:42 +02:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Invoice Ninja (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
|
|
|
|
*
|
|
|
|
* @license https://opensource.org/licenses/AAL
|
|
|
|
*/
|
|
|
|
|
|
|
|
namespace App\Factory;
|
|
|
|
|
|
|
|
use App\DataMapper\CompanySettings;
|
|
|
|
use App\Models\Company;
|
|
|
|
use App\Utils\Traits\MakesHash;
|
|
|
|
|
|
|
|
class CompanyFactory
|
|
|
|
{
|
|
|
|
use MakesHash;
|
|
|
|
|
|
|
|
public static function create(int $account_id) :Company
|
|
|
|
{
|
|
|
|
|
|
|
|
$company = new Company;
|
2019-10-04 14:37:40 +02: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');
|
2019-11-21 09:38:57 +01:00
|
|
|
$company->custom_fields = (object) ['custom1' => '1', 'custom2' => '2', 'custom3'=>3];
|
2019-07-12 07:03:30 +02:00
|
|
|
$company->domain = '';
|
|
|
|
|
2019-06-17 02:15:42 +02:00
|
|
|
return $company;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|