File tree Expand file tree Collapse file tree 3 files changed +16
-12
lines changed Expand file tree Collapse file tree 3 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ Please see the [changelog](CHANGELOG.md) for more information on what has change
3131
3232Via Composer
3333
34- ### Laravel version 8  
34+ ### Laravel version <=  8  
3535
3636``` bash 
3737$ composer require laraveldaily/laravel-invoices:^2.0
@@ -322,6 +322,8 @@ Almost every configuration value can be overrided dinamically by methods.
322322-  name(string)
323323-  seller(PartyContract)
324324-  buyer(PartyContract)
325+ -  setCustomData(mixed) - allows user to attach additional data to invoice
326+ -  getCustomData() - retrieves additional data to use in template
325327-  template(string)
326328-  logo(string) - path to logo
327329-  getLogo() - returns base64 encoded image, used in template to avoid path issues
Original file line number Diff line number Diff line change @@ -71,11 +71,6 @@ class Invoice
7171     */ 
7272    public  $ logo ;
7373
74-     /** 
75-      * @var array 
76-      */ 
77-     public  $ custom ;
78- 
7974    /** 
8075     * @var float 
8176     */ 
@@ -141,6 +136,11 @@ class Invoice
141136     */ 
142137    public  $ output ;
143138
139+     /** 
140+      * @var mixed 
141+      */ 
142+     protected  $ userDefinedData ;
143+ 
144144    /** 
145145     * Invoice constructor. 
146146     * @param string $name 
@@ -178,9 +178,6 @@ public function __construct($name = 'Invoice')
178178        $ this  ->currency_thousands_separator  = config ('invoices.currency.thousands_separator ' );
179179        $ this  ->currency_format               = config ('invoices.currency.format ' );
180180
181-         // Custom data 
182-         $ this  ->custom  = [];
183- 
184181        $ this  ->disk           = config ('invoices.disk ' );
185182        $ this  ->table_columns  = static ::TABLE_COLUMNS ;
186183    }
Original file line number Diff line number Diff line change @@ -154,16 +154,21 @@ public function buyer(PartyContract $buyer)
154154    }
155155
156156    /** 
157-      * @param PartyContract $buyer  
157+      * @param mixed  
158158     * @return $this 
159159     */ 
160-     public  function  custom ( array   $ custom  )
160+     public  function  setCustomData ( $ value  )
161161    {
162-         $ this  ->custom  = $ custom  ;
162+         $ this  ->userDefinedData  = $ value  ;
163163
164164        return  $ this  ;
165165    }
166166
167+     public  function  getCustomData ()
168+     {
169+         return  $ this  ->userDefinedData ;
170+     }
171+ 
167172    /** 
168173     * @param string $template 
169174     * @return $this 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments