Skip to content

Commit

Permalink
Fixed column name spelling in DB
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Nov 25, 2013
1 parent dab7ec3 commit ad680a3
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 10 deletions.
6 changes: 3 additions & 3 deletions app/controllers/admin/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public function postCreate()
$asset->notes = e(Input::get('notes'));
$asset->asset_tag = e(Input::get('asset_tag'));
$asset->status_id = e(Input::get('status_id'));
$asset->warrantee_months = e(Input::get('warrantee_months'));
$asset->warranty_months = e(Input::get('warranty_months'));
$asset->user_id = Sentry::getId();
$asset->physical = '1';

Expand Down Expand Up @@ -192,7 +192,7 @@ public function postEdit($assetId = null)
'asset_tag' => 'required|min:3',
'model_id' => 'required',
'serial' => 'required|min:3',
'warrantee_months' => 'integer|min:1',
'warranty_months' => 'integer|min:1',
);

// Create a new validator instance from our validation rules
Expand All @@ -215,7 +215,7 @@ public function postEdit($assetId = null)
$asset->order_number = e(Input::get('order_number'));
$asset->asset_tag = e(Input::get('asset_tag'));
$asset->status_id = e(Input::get('status_id'));
$asset->warrantee_months = e(Input::get('warrantee_months'));
$asset->warranty_months = e(Input::get('warranty_months'));
$asset->notes = e(Input::get('notes'));
$asset->physical = '1';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

use Illuminate\Database\Migrations\Migration;

class AlterWarrantyColumnOnAssets extends Migration {

/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement('ALTER TABLE assets CHANGE warrantee_months warranty_months int (3)');
}

/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}

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


Expand Down Expand Up @@ -110,7 +110,7 @@ public function warrantee_expires()


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

}
Expand Down
6 changes: 3 additions & 3 deletions app/views/backend/assets/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@
</div>

<!-- Warrantee -->
<div class="control-group {{ $errors->has('warrantee_months') ? 'error' : '' }}">
<div class="control-group {{ $errors->has('warranty_months') ? 'error' : '' }}">
<label class="control-label" for="serial">Warranty</label>
<div class="controls">
<input class="span1" type="text" name="warrantee_months" id="warrantee_months" value="{{ Input::old('warrantee_months', $asset->warrantee_months) }}" /> months
{{ $errors->first('warrantee_months', '<span class="help-inline">:message</span>') }}
<input class="span1" type="text" name="warranty_months" id="warranty_months" value="{{ Input::old('warranty_months', $asset->warranty_months) }}" /> months
{{ $errors->first('warranty_months', '<span class="help-inline">:message</span>') }}
</div>
</div>

Expand Down
4 changes: 2 additions & 2 deletions app/views/backend/assets/view.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@
@if ($asset->order_number)
<li>Order #: {{ $asset->order_number }} </li>
@endif
@if ($asset->warrantee_months)
<li>Warranty: {{ $asset->warrantee_months }} months</li>
@if ($asset->warranty_months)
<li>Warranty: {{ $asset->warranty_months }} months</li>
<li>Expires: {{ $asset->warrantee_expires() }}</li>
@endif
</ul>
Expand Down

0 comments on commit ad680a3

Please sign in to comment.