Skip to content

Commit

Permalink
Fixes #50
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Nov 26, 2013
1 parent d0cbb9f commit 5bf38b1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions app/controllers/admin/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ public function postEdit($assetId = null)

// Declare the rules for the form validation
$rules = array(
'name' => 'required|min:3',
'asset_tag' => 'required|min:3',
'name' => 'required|alpha_dash|min:3',
'asset_tag' => 'required|alpha_dash|min:3',
'model_id' => 'required',
'serial' => 'required|min:3',
'serial' => 'required|alpha_dash|min:3',
'warranty_months' => 'integer|min:1',
);

Expand Down
12 changes: 10 additions & 2 deletions app/models/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@ class Asset extends Elegant {
'name' => 'required|alpha_dash|min:3',
'asset_tag' => 'required|min:3|unique:assets',
'model_id' => 'required',
'serial' => 'required|min:3',
'serial' => 'required|alpha_dash|min:3',
'warranty_months' => 'integer|min:1',
'purchase_cost' => 'integer|min:1',
);


Expand Down Expand Up @@ -113,6 +112,15 @@ public function warrantee_expires()
date_add($date, date_interval_create_from_date_string($this->warranty_months.' months'));
return date_format($date, 'Y-m-d');

}

public function months_until_depreciated()
{

$date = date_create($this->purchase_date);
date_add($date, date_interval_create_from_date_string($this->depreciation()->months.' months'));
return date_format($date, 'Y-m-d');

}

public function depreciation()
Expand Down

0 comments on commit 5bf38b1

Please sign in to comment.