|
|
@@ -5,31 +5,33 @@ namespace App;
|
|
|
use App\Traits\ModelTimeFormat;
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
-use App\Traits\LogModelChanging;
|
|
|
+use App\Traits\ModelLogChanging;
|
|
|
+use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
+use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
|
|
|
|
class OwnerMaterial extends Model
|
|
|
{
|
|
|
- use LogModelChanging;
|
|
|
+ use ModelLogChanging;
|
|
|
use ModelTimeFormat;
|
|
|
protected $table = 'owner_material';
|
|
|
protected $fillable = ['owner_id','material_id','material_code','size','special','specification','initiator'];
|
|
|
|
|
|
- public function owner()
|
|
|
+ public function owner():BelongsTo
|
|
|
{
|
|
|
return $this->belongsTo(Owner::class);
|
|
|
}
|
|
|
|
|
|
- public function material()
|
|
|
+ public function material():BelongsTo
|
|
|
{
|
|
|
return $this->belongsTo(Material::class);
|
|
|
}
|
|
|
|
|
|
- public function initiator()
|
|
|
+ public function initiator():BelongsTo
|
|
|
{
|
|
|
return $this->belongsTo(User::class,'initiator','id');
|
|
|
}
|
|
|
|
|
|
- public function file()
|
|
|
+ public function file():HasOne
|
|
|
{
|
|
|
return $this->hasOne(UploadFile::class,'table_id','id')->where('table_name','owner_material');
|
|
|
}
|