From e49420f62d26405b2fa0385f0ae7b3009b3beeaf Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 3 Dec 2013 03:02:00 -0500 Subject: [PATCH] Fixed bug in depreciation display --- app/models/Model.php | 2 +- app/views/backend/models/index.blade.php | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/models/Model.php b/app/models/Model.php index b9fab8c017..62cc54eb8b 100644 --- a/app/models/Model.php +++ b/app/models/Model.php @@ -22,7 +22,7 @@ class Model extends Elegant { public function depreciation() { - return $this->belongsTo('Depreciation','id'); + return $this->belongsTo('Depreciation','depreciation_id'); } public function adminuser() diff --git a/app/views/backend/models/index.blade.php b/app/views/backend/models/index.blade.php index 0a1f283265..ee007147d8 100755 --- a/app/views/backend/models/index.blade.php +++ b/app/views/backend/models/index.blade.php @@ -35,9 +35,13 @@ Asset Models :: {{ $model->modelno }} {{ ($model->assets->count()) }} - @if ($model->depreciation) - {{ $model->depreciation->name }} - ({{ $model->depreciation->months }} months) + + + @if (($model->depreciation) && ($model->depreciation->id > 0)) + {{ $model->depreciation->name }} + ({{ $model->depreciation->months }} months) + @else + No Depreciation @endif