fix edit products using new workflow mutations
This commit is contained in:
@@ -41,4 +41,11 @@ class Dealer extends Model
|
||||
{
|
||||
return $this->hasMany(Stock::class);
|
||||
}
|
||||
|
||||
public function products()
|
||||
{
|
||||
return $this->belongsToMany(Product::class, 'stocks', 'dealer_id', 'product_id')
|
||||
->withPivot('quantity')
|
||||
->withTimestamps();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,13 @@ class Product extends Model
|
||||
return $this->hasMany(MutationDetail::class);
|
||||
}
|
||||
|
||||
public function dealers()
|
||||
{
|
||||
return $this->belongsToMany(Dealer::class, 'stocks', 'product_id', 'dealer_id')
|
||||
->withPivot('quantity')
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
// Helper method untuk mendapatkan total stock saat ini
|
||||
public function getCurrentTotalStockAttribute()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user