change pack to label

This commit is contained in:
Fayyazi
2019-10-28 14:16:18 +03:30
parent 7c94a30254
commit dbd0ddc1d4
16 changed files with 254 additions and 112 deletions
+8 -4
View File
@@ -6,18 +6,22 @@ use Illuminate\Database\Eloquent\Model;
class Package extends Model
{
public $fillable = ['name', 'unique_id', 'user_id', 'note', 'verified'];
public $fillable = ['name', 'unique_id', 'user_id', 'note', 'verified', 'label_id'];
public function user()
{
return $this->belongsTo('App\User');
}
public function items()
{
return $this->belongsToMany('App\Item', 'item_package');
return $this->belongsToMany('App\Item', 'item_package')->withPivot('count');
}
public function packs()
// public function packs()
// {
// return $this->belongsToMany('App\Pack', 'pack_package');
// }
public function labels()
{
return $this->belongsToMany('App\Pack', 'pack_package');
return $this->hasMany('App\Label');
}
}