Possible alternative to fixing #13296 - custom report failing when the model is busted

Related: https://github.com/snipe/snipe-it/pull/13297
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2023-07-20 17:45:45 +01:00
parent 0b8a3ee9a5
commit 540b09c506

View file

@ -390,7 +390,7 @@ class Asset extends Depreciable
*/
public function depreciation()
{
return $this->model->belongsTo(\App\Models\Depreciation::class, 'depreciation_id');
return $this->hasOneThrough(\App\Models\Depreciation::class,\App\Models\AssetModel::class,'id','id','model_id','depreciation_id');
}