Fixes bug #3086 - unabel to create asset from asset model screen

This commit is contained in:
snipe 2016-12-22 17:08:42 -08:00
parent d6b7036518
commit fc18aa7f6d
2 changed files with 5 additions and 5 deletions

View file

@ -106,10 +106,9 @@ class AssetsController extends Controller
* @param integer $model_id
* @return View
*/
public function create($model_id = null)
public function create(Request $request)
{
$this->authorize('create', Asset::class);
// Grab the dropdown lists
$view = View::make('hardware/edit');
$view->with('supplier_list', Helper::suppliersList());
$view->with('company_list', Helper::companyList());
@ -122,9 +121,10 @@ class AssetsController extends Controller
$view->with('category', Helper::categoryList('asset'));
$view->with('statuslabel_types', Helper::statusTypeList());
if (!is_null($model_id)) {
$selected_model = AssetModel::find($model_id);
if ($request->has('model_id')) {
$selected_model = AssetModel::find($request->input('model_id'));
$view->with('selected_model', $selected_model);
} else {
}
return $view;

View file

@ -17,7 +17,7 @@
@if ($model->deleted_at=='')
<li><a href="{{ route('models.edit', $model->id) }}">{{ trans('admin/models/table.edit') }}</a></li>
<li><a href="{{ route('clone/model', $model->id) }}">{{ trans('admin/models/table.clone') }}</a></li>
<li><a href="{{ route('hardware.create', $model->id) }}">{{ trans('admin/hardware/form.create') }}</a></li>
<li><a href="{{ route('hardware.create', ['model_id' => $model->id]) }}">{{ trans('admin/hardware/form.create') }}</a></li>
@else
<li><a href="{{ route('restore/model', $model->id) }}">{{ trans('admin/models/general.restore') }}</a></li>
@endif