Skip to content

Commit

Permalink
Fixed checkmodel at route level
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Mar 28, 2015
1 parent d2e23ad commit 5d946b1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
4 changes: 2 additions & 2 deletions app/controllers/admin/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public function postCreate()
} else {
$asset->rtd_location_id = e(Input::get('rtd_location_id'));
}
$checkModel = $asset->checkModel(e(Input::get('model_id')));

$asset->mac_address = ($checkModel == true) ? e(Input::get('mac_address')) : NULL;

// Save the asset data
Expand Down Expand Up @@ -292,7 +292,7 @@ public function postEdit($assetId = null)
$asset->rtd_location_id = e(Input::get('rtd_location_id'));
}

$checkModel = $this->checkModel(e(Input::get('model_id')));

$asset->mac_address = ($checkModel == true) ? e(Input::get('mac_address')) : NULL;

// Update the asset data
Expand Down
7 changes: 0 additions & 7 deletions app/models/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,6 @@ public function assetNameForEula()
}
}


public function checkModel($modelId) {
$model = Model::find($modelId);
return $model->show_mac_address;
}


public function warrantee_expires()
{
$date = date_create($this->purchase_date);
Expand Down
8 changes: 6 additions & 2 deletions app/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,12 @@
/*---Models API---*/
Route::group(array('prefix'=>'models'), function() {
Route::resource('/', 'ModelsController');
Route::get('list/{status?}', array('as'=>'api.models.list', 'uses'=>'ModelsController@getDatatable'));
Route::get('{modelId}/check', array('as' => 'api.models.check', 'uses' => 'ModelsController@checkModel'));
Route::get('list/{status?}', array('as'=>'api.models.list', 'uses'=>'ModelsController@getDatatable'));
Route::get('{modelId}/check', function ($modelId) {
$model = Model::find($modelId);
return $model->show_mac_address;
});

Route::get('{modelID}/view', array('as'=>'api.models.view', 'uses'=>'ModelsController@getDataView'));
});
/*--- Categories API---*/
Expand Down

0 comments on commit 5d946b1

Please sign in to comment.