Skip to content

Commit

Permalink
Fixed compact() errors
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Apr 8, 2020
1 parent b7d9790 commit 0b3f511
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 38 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/AccessoriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public function show(Request $request, $accessoryID = null)
if (isset($accessory->id)) {
return view('accessories/view', compact('accessory'));
}
return redirect()->route('accessories.index')->with('error', trans('admin/accessories/message.does_not_exist', compact('id')));
return redirect()->route('accessories.index')->with('error', trans('admin/accessories/message.does_not_exist'));
}

/**
Expand Down
5 changes: 1 addition & 4 deletions app/Http/Controllers/AssetModelsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,8 @@ public function show($modelId = null)
if (isset($model->id)) {
return view('models/view', compact('model'));
}
// Prepare the error message
$error = trans('admin/models/message.does_not_exist', compact('id'));

// Redirect to the user management page
return redirect()->route('models.index')->with('error', $error);
return redirect()->route('models.index')->with('error', trans('admin/models/message.does_not_exist'));
}

/**
Expand Down
5 changes: 1 addition & 4 deletions app/Http/Controllers/CategoriesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,7 @@ public function show($id)
->with('category_type_route',$category_type_route);
}

// Prepare the error message
$error = trans('admin/categories/message.does_not_exist', compact('id'));
// Redirect to the user management page
return redirect()->route('categories.index')->with('error', $error);
return redirect()->route('categories.index')->with('error', trans('admin/categories/message.does_not_exist'));
}


Expand Down
6 changes: 2 additions & 4 deletions app/Http/Controllers/ComponentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,8 @@ public function show($componentId = null)
$this->authorize('view', $component);
return view('components/view', compact('component'));
}
// Prepare the error message
$error = trans('admin/components/message.does_not_exist', compact('id'));
// Redirect to the user management page
return redirect()->route('components.index')->with('error', $error);

return redirect()->route('components.index')->with('error', trans('admin/components/message.does_not_exist'));
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/DepartmentsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function show($id)
if (isset($department->id)) {
return view('departments/view', compact('department'));
}
return redirect()->route('departments.index')->with('error', trans('admin/departments/message.does_not_exist', compact('id')));
return redirect()->route('departments.index')->with('error', trans('admin/departments/message.does_not_exist'));
}


Expand Down
11 changes: 5 additions & 6 deletions app/Http/Controllers/LicensesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ public function show($licenseId = null)
$this->authorize('view', $license);
return view('licenses/view', compact('license'));
}
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.does_not_exist', compact('id')));
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.does_not_exist'));
}


Expand Down Expand Up @@ -524,9 +524,8 @@ public function postUpload(AssetFileRequest $request, $licenseId = null)
}
return redirect()->route('licenses.show', $license->id)->with('error', trans('admin/licenses/message.upload.nofiles'));
}
// Prepare the error message
$error = trans('admin/licenses/message.does_not_exist', compact('id'));
return redirect()->route('licenses.index')->with('error', $error);

return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.does_not_exist'));
}


Expand Down Expand Up @@ -562,7 +561,7 @@ public function getDeleteFile($licenseId = null, $fileId = null)
}

// Redirect to the licence management page
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.does_not_exist', compact('id')));
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.does_not_exist'));
}


Expand Down Expand Up @@ -613,7 +612,7 @@ public function displayFile($licenseId = null, $fileId = null, $download = true)
}


return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.does_not_exist', compact('id')));
return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.does_not_exist'));
}


Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/LocationsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public function show($locationId = null)
return view('locations/view', compact('location'));
}

return redirect()->route('locations.index')->with('error', trans('admin/locations/message.does_not_exist', compact('id')));
return redirect()->route('locations.index')->with('error', trans('admin/locations/message.does_not_exist'));
}

}
2 changes: 1 addition & 1 deletion app/Http/Controllers/StatuslabelsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function show($id)
return view('statuslabels.view')->with('statuslabel', $statuslabel);
}

return redirect()->route('statuslabels.index')->with('error', trans('admin/statuslabels/message.does_not_exist', compact('id')));
return redirect()->route('statuslabels.index')->with('error', trans('admin/statuslabels/message.does_not_exist'));
}


Expand Down
5 changes: 1 addition & 4 deletions app/Http/Controllers/SuppliersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,8 @@ public function show($supplierId = null)
if (isset($supplier->id)) {
return view('suppliers/view', compact('supplier'));
}
// Prepare the error message
$error = trans('admin/suppliers/message.does_not_exist', compact('id'));

// Redirect to the user management page
return redirect()->route('suppliers.index')->with('error', $error);
return redirect()->route('suppliers.index')->with('error', trans('admin/suppliers/message.does_not_exist'));
}

}
22 changes: 10 additions & 12 deletions app/Http/Controllers/UsersController.php
Original file line number Diff line number Diff line change
Expand Up @@ -606,10 +606,12 @@ public function getRestore($id = null)
*/
public function show($userId = null)
{
if(!$user = User::with('assets', 'assets.model', 'consumables', 'accessories', 'licenses', 'userloc')->withTrashed()->find($userId)) {
$error = trans('admin/users/message.user_not_found', compact('id'));
// Redirect to the user management page
return redirect()->route('users.index')->with('error', $error);
if (!$user = User::with('assets', 'assets.model', 'consumables', 'accessories', 'licenses', 'userloc')
->withTrashed()
->find($userId))
{

return redirect()->route('users.index')->with('error', trans('admin/users/message.user_not_found', ['id' => $userId]));
}

$userlog = $user->userlog->load('item');
Expand Down Expand Up @@ -706,10 +708,8 @@ public function getClone($id = null)
->with('userGroups', $userGroups)
->with('clone_user', $user_to_clone);
} catch (UserNotFoundException $e) {
// Prepare the error message
$error = trans('admin/users/message.user_not_found', compact('id'));
// Redirect to the user management page
return redirect()->route('users.index')->with('error', $error);

return redirect()->route('users.index')->with('error', trans('admin/users/message.user_not_found'));
}
}

Expand Down Expand Up @@ -790,10 +790,8 @@ public function getDeleteFile($userId = null, $fileId = null)
$log->delete();
return redirect()->back()->with('success', trans('admin/users/message.deletefile.success'));
}
// Prepare the error message
$error = trans('admin/users/message.does_not_exist', compact('id'));
// Redirect to the licence management page
return redirect()->route('users.index')->with('error', $error);

return redirect()->route('users.index')->with('error', trans('admin/users/message.does_not_exist'));

}

Expand Down

0 comments on commit 0b3f511

Please sign in to comment.