diff --git a/app/Models/Asset.php b/app/Models/Asset.php index 5d59365706..93cbec7671 100644 --- a/app/Models/Asset.php +++ b/app/Models/Asset.php @@ -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 */ diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index 50891463fc..b5cbb41fe0 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -50,9 +50,13 @@
| {{ $component->name }} | +||||||
| {{ $use_currency.$totalCost }} | +||||||