1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/app/Factory/ClientFactory.php
2019-04-24 20:01:40 +10:00

30 lines
681 B
PHP

<?php
namespace App\Factory;
use App\DataMapper\ClientSettings;
use App\Models\Client;
class ClientFactory
{
public static function create(int $company_id, int $user_id) :Client
{
$client = new Client;
$client->company_id = $company_id;
$client->user_id = $user_id;
$client->name = '';
$client->website = '';
$client->private_notes = '';
$client->balance = 0;
$client->paid_to_date = 0;
$client->country_id = 4;
$client->is_deleted = 0;
$client->settings = new ClientSettings(ClientSettings::defaults());
$client_contact = ClientContactFactory::create($company_id, $user_id);
$client->contacts->add($client_contact);
return $client;
}
}