mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 22:47:32 -05:00 
			
		
		
		
	* Testing Company Ledger * Fixes for company ledger * Fixes for company ledger * Company ledger testS * Fixes for user / client / contacts transformers * Fixes for tests * Fixes for tokens
		
			
				
	
	
		
			42 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			42 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
/**
 | 
						|
 * Invoice Ninja (https://invoiceninja.com)
 | 
						|
 *
 | 
						|
 * @link https://github.com/invoiceninja/invoiceninja source repository
 | 
						|
 *
 | 
						|
 * @copyright Copyright (c) 2020. Invoice Ninja LLC (https://invoiceninja.com)
 | 
						|
 *
 | 
						|
 * @license https://opensource.org/licenses/AAL
 | 
						|
 */
 | 
						|
 | 
						|
namespace App\Factory;
 | 
						|
 | 
						|
use App\DataMapper\ClientSettings;
 | 
						|
use App\Models\Client;
 | 
						|
use Illuminate\Support\Str;
 | 
						|
 | 
						|
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->public_notes = '';
 | 
						|
        $client->balance = 0;
 | 
						|
        $client->paid_to_date = 0;
 | 
						|
        $client->country_id = 4;
 | 
						|
        $client->is_deleted = 0;
 | 
						|
        $client->client_hash = Str::random(40);
 | 
						|
        $client->settings = ClientSettings::defaults();
 | 
						|
        
 | 
						|
        $client_contact = ClientContactFactory::create($company_id, $user_id);
 | 
						|
        $client->contacts->add($client_contact);
 | 
						|
 | 
						|
        return $client;
 | 
						|
    }
 | 
						|
}
 |