Components display on assets page
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user