Components display on assets page

This commit is contained in:
snipe
2016-05-18 19:26:50 -07:00
parent fb26188e41
commit c1c7fa143d
2 changed files with 40 additions and 1 deletions
+9 -1
View File
@@ -213,7 +213,7 @@ class Asset extends Depreciable
}
/**
/**
* Set depreciation relationship
*/
public function depreciation()
@@ -221,6 +221,14 @@ class Asset extends Depreciable
return $this->model->belongsTo('\App\Models\Depreciation', 'depreciation_id');
}
/**
* Get components assigned to this asset
*/
public function components()
{
return $this->belongsToMany('\App\Models\Component', 'components_assets', 'asset_id', 'component_id')->withPivot('id')->withTrashed();
}
/**
* Get depreciation attribute from associated asset model
*/