update item & package & label & cycle

This commit is contained in:
Fayyazi
2019-10-30 14:19:47 +03:30
parent dbd0ddc1d4
commit da3dd22ec5
19 changed files with 292 additions and 109 deletions
+2 -6
View File
@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
class Label extends Model
{
public $fillable = ['name', 'sterile_date', 'expire_date', 'sterilizer_id', 'cycle_number', 'lot_number', 'department', 'user_id', 'note'];
public $fillable = ['name', 'sterile_date', 'expire_date', 'sterilizer_id', 'cycle_number', 'lot_number', 'department', 'user_id', 'note', 'package_id'];
public function user()
{
return $this->belongsTo('App\User');
@@ -15,13 +15,9 @@ class Label extends Model
{
return $this->belongsTo('App\Package');
}
// public function packages()
// {
// return $this->belongsToMany('App\Package', 'pack_package');
// }
public function cycles()
{
return $this->belongsToMany('App\Cycle', 'cycle_pack');
return $this->belongsToMany('App\Cycle', 'cycle_label')->withPivot('count');
}
}