Merge pull request #13347 from snipe/fixes/custom_report_error_on_bad_model

Possible alternative to fixing #13296 - custom report failing when th…
This commit is contained in:
snipe 2023-07-21 15:18:16 +01:00 committed by GitHub
commit 39ea15a27a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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');
}