Added assets relationship

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-08-28 12:38:55 +01:00
parent a5ff623484
commit eb5d93b3c2

View file

@ -75,4 +75,17 @@ class Depreciation extends SnipeModel
{ {
return $this->hasMany(\App\Models\License::class, 'depreciation_id'); return $this->hasMany(\App\Models\License::class, 'depreciation_id');
} }
/**
* Establishes the depreciation -> assets relationship
*
* @author A. Gianotto <snipe@snipe.net>
* @since [v5.0]
* @return \Illuminate\Database\Eloquent\Relations\Relation
*/
public function assets()
{
return $this->hasManyThrough(\App\Models\Asset::class, \App\Models\AssetModel::class, 'depreciation_id', 'model_id');
}
} }