mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-30 21:21:09 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			27 lines
		
	
	
		
			462 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			27 lines
		
	
	
		
			462 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace Crater;
 | |
| 
 | |
| use Illuminate\Database\Eloquent\Model;
 | |
| use Crater\Item;
 | |
| 
 | |
| class Unit extends Model
 | |
| {
 | |
|     protected $fillable = ['name', 'company_id'];
 | |
| 
 | |
|     public function items()
 | |
|     {
 | |
|         return $this->hasMany(Item::class);
 | |
|     }
 | |
| 
 | |
|     public function company()
 | |
|     {
 | |
|         return $this->belongsTo(Company::class);
 | |
|     }
 | |
| 
 | |
|     public function scopeWhereCompany($query, $company_id)
 | |
|     {
 | |
|         $query->where('company_id', $company_id);
 | |
|     }
 | |
| }
 |