2019-01-27 23:13:12 +01:00
|
|
|
<?php
|
2019-05-11 05:32:07 +02:00
|
|
|
/**
|
2020-09-06 11:38:10 +02:00
|
|
|
* Invoice Ninja (https://invoiceninja.com).
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
|
|
|
* @link https://github.com/invoiceninja/invoiceninja source repository
|
|
|
|
*
|
2024-04-12 06:15:41 +02:00
|
|
|
* @copyright Copyright (c) 2024. Invoice Ninja LLC (https://invoiceninja.com)
|
2019-05-11 05:32:07 +02:00
|
|
|
*
|
2021-06-16 08:58:16 +02:00
|
|
|
* @license https://www.elastic.co/licensing/elastic-license
|
2019-05-11 05:32:07 +02:00
|
|
|
*/
|
2019-01-27 23:13:12 +01:00
|
|
|
|
|
|
|
namespace App\Factory;
|
|
|
|
|
2019-02-17 11:34:46 +01:00
|
|
|
use App\DataMapper\ClientSettings;
|
2019-01-27 23:13:12 +01:00
|
|
|
use App\Models\Client;
|
2019-09-26 15:00:51 +02:00
|
|
|
use Illuminate\Support\Str;
|
2019-01-27 23:13:12 +01:00
|
|
|
|
|
|
|
class ClientFactory
|
|
|
|
{
|
2024-01-14 05:05:00 +01:00
|
|
|
public static function create(int $company_id, int $user_id): Client
|
2019-12-30 22:59:12 +01:00
|
|
|
{
|
2024-01-14 05:05:00 +01:00
|
|
|
$client = new Client();
|
2019-12-30 22:59:12 +01:00
|
|
|
$client->company_id = $company_id;
|
|
|
|
$client->user_id = $user_id;
|
|
|
|
$client->name = '';
|
|
|
|
$client->website = '';
|
|
|
|
$client->private_notes = '';
|
2020-02-26 04:26:07 +01:00
|
|
|
$client->public_notes = '';
|
2019-12-30 22:59:12 +01:00
|
|
|
$client->balance = 0;
|
|
|
|
$client->paid_to_date = 0;
|
2022-03-24 09:55:57 +01:00
|
|
|
$client->country_id = null;
|
2024-06-15 09:34:08 +02:00
|
|
|
$client->is_deleted = false;
|
2019-12-30 22:59:12 +01:00
|
|
|
$client->client_hash = Str::random(40);
|
|
|
|
$client->settings = ClientSettings::defaults();
|
2023-09-11 03:05:05 +02:00
|
|
|
$client->classification = '';
|
2024-01-14 05:05:00 +01:00
|
|
|
|
2019-12-30 22:59:12 +01:00
|
|
|
return $client;
|
|
|
|
}
|
2019-01-27 23:13:12 +01:00
|
|
|
}
|