create feature sa create list claim and price to work per dealer

This commit is contained in:
2025-07-07 19:11:04 +07:00
parent fa554446ca
commit 956df5cfe6
16 changed files with 3062 additions and 404 deletions

View File

@@ -48,4 +48,38 @@ class Dealer extends Model
->withPivot('quantity')
->withTimestamps();
}
/**
* Get all work prices for this dealer
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function workPrices()
{
return $this->hasMany(WorkDealerPrice::class);
}
/**
* Get price for specific work
*
* @param int $workId
* @return WorkDealerPrice|null
*/
public function getPriceForWork($workId)
{
return $this->workPrices()
->where('work_id', $workId)
->active()
->first();
}
/**
* Get all active work prices for this dealer
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function activeWorkPrices()
{
return $this->hasMany(WorkDealerPrice::class)->active();
}
}