| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- <?php
- namespace App;
- use App\Traits\ModelTimeFormat;
- use Illuminate\Database\Eloquent\Model;
- use App\Traits\LogModelChanging;
- class OwnerMaterial extends Model
- {
- use LogModelChanging;
- use ModelTimeFormat;
- protected $table = 'owner_material';
- protected $fillable = ['owner_id','material_id','material_code','size','special','specification','initiator'];
- public function owner()
- {
- return $this->belongsTo(Owner::class);
- }
- public function material()
- {
- return $this->belongsTo(Material::class);
- }
- public function initiator()
- {
- return $this->belongsTo(User::class,'initiator','id');
- }
- public function file()
- {
- return $this->hasOne(UploadFile::class,'table_id','id')->where('table_name','owner_material');
- }
- public function scopeFilter($query,$filters)
- {
- return $filters->apply($query);
- }
- }
|