mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 22:07:33 -05:00 
			
		
		
		
	Fixes for N+1
This commit is contained in:
		
							parent
							
								
									af8c56a1f1
								
							
						
					
					
						commit
						ebca34503b
					
				@ -204,6 +204,7 @@ class PreviewController extends BaseController
 | 
			
		||||
            if($request->has('entity_id')){
 | 
			
		||||
 | 
			
		||||
                $entity_obj = $class::on(config('database.default'))
 | 
			
		||||
                                    ->with('client.contacts.company')
 | 
			
		||||
                                    ->where('id', $this->decodePrimaryKey($request->input('entity_id')))
 | 
			
		||||
                                    ->where('company_id', $company->id)
 | 
			
		||||
                                    ->withTrashed()
 | 
			
		||||
@ -216,7 +217,7 @@ class PreviewController extends BaseController
 | 
			
		||||
            if(!$request->has('entity_id'))
 | 
			
		||||
                $entity_obj->service()->fillDefaults()->save();
 | 
			
		||||
                
 | 
			
		||||
            $entity_obj->load('client.contacts','company');
 | 
			
		||||
            // $entity_obj->load('client.contacts','client.company');
 | 
			
		||||
 | 
			
		||||
            App::forgetInstance('translator');
 | 
			
		||||
            $t = app('translator');
 | 
			
		||||
 | 
			
		||||
@ -449,6 +449,8 @@ class InvoiceService
 | 
			
		||||
 | 
			
		||||
    public function fillDefaults()
 | 
			
		||||
    {
 | 
			
		||||
        $this->invoice->load('client.company');
 | 
			
		||||
        
 | 
			
		||||
        $settings = $this->invoice->client->getMergedSettings();
 | 
			
		||||
 | 
			
		||||
        if (! $this->invoice->design_id) 
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user