mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-10-31 16:17:32 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			57 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			57 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php namespace App\Models;
 | |
| 
 | |
| use Auth;
 | |
| use Illuminate\Database\Eloquent\SoftDeletes;
 | |
| 
 | |
| class Product extends EntityModel
 | |
| {
 | |
|     use SoftDeletes;
 | |
|     protected $dates = ['deleted_at'];
 | |
| 
 | |
|     protected $fillable = [
 | |
|         'product_key',
 | |
|         'notes',
 | |
|         'cost',
 | |
|         'qty',
 | |
|         'default_tax_rate_id',
 | |
|     ];
 | |
| 
 | |
|     public static function getImportColumns()
 | |
|     {
 | |
|         return [
 | |
|             'product_key',
 | |
|             'notes',
 | |
|             'cost',
 | |
|         ];
 | |
|     }
 | |
| 
 | |
|     public static function getImportMap()
 | |
|     {
 | |
|         return [
 | |
|             'product|item' => 'product_key',
 | |
|             'notes|description|details' => 'notes',
 | |
|             'cost|amount|price' => 'cost',
 | |
|         ];
 | |
|     }
 | |
| 
 | |
|     public function getEntityType()
 | |
|     {
 | |
|         return ENTITY_PRODUCT;
 | |
|     }
 | |
| 
 | |
|     public static function findProductByKey($key)
 | |
|     {
 | |
|         return Product::scope()->where('product_key', '=', $key)->first();
 | |
|     }
 | |
| 
 | |
|     public function user()
 | |
|     {
 | |
|         return $this->belongsTo('App\Models\User')->withTrashed();
 | |
|     }
 | |
| 
 | |
|     public function default_tax_rate()
 | |
|     {
 | |
|         return $this->belongsTo('App\Models\TaxRate');
 | |
|     }
 | |
| }
 |