Fixed compact() errors

This commit is contained in:
snipe 2020-04-07 17:26:56 -07:00
parent b7d9790acb
commit 0b3f511534
No known key found for this signature in database
GPG key ID: 10BFFDA3ED34B5AC
10 changed files with 24 additions and 38 deletions

View file

@ -198,7 +198,7 @@ class AccessoriesController extends Controller
if (isset($accessory->id)) { if (isset($accessory->id)) {
return view('accessories/view', compact('accessory')); 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'));
} }
/** /**

View file

@ -259,11 +259,8 @@ class AssetModelsController extends Controller
if (isset($model->id)) { if (isset($model->id)) {
return view('models/view', compact('model')); 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', trans('admin/models/message.does_not_exist'));
return redirect()->route('models.index')->with('error', $error);
} }
/** /**

View file

@ -219,10 +219,7 @@ class CategoriesController extends Controller
->with('category_type_route',$category_type_route); ->with('category_type_route',$category_type_route);
} }
// Prepare the error message return redirect()->route('categories.index')->with('error', trans('admin/categories/message.does_not_exist'));
$error = trans('admin/categories/message.does_not_exist', compact('id'));
// Redirect to the user management page
return redirect()->route('categories.index')->with('error', $error);
} }

View file

@ -199,10 +199,8 @@ class ComponentsController extends Controller
$this->authorize('view', $component); $this->authorize('view', $component);
return view('components/view', compact('component')); return view('components/view', compact('component'));
} }
// Prepare the error message
$error = trans('admin/components/message.does_not_exist', compact('id')); return redirect()->route('components.index')->with('error', trans('admin/components/message.does_not_exist'));
// Redirect to the user management page
return redirect()->route('components.index')->with('error', $error);
} }
/** /**

View file

@ -79,7 +79,7 @@ class DepartmentsController extends Controller
if (isset($department->id)) { if (isset($department->id)) {
return view('departments/view', compact('department')); 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'));
} }

View file

@ -455,7 +455,7 @@ class LicensesController extends Controller
$this->authorize('view', $license); $this->authorize('view', $license);
return view('licenses/view', compact('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'));
} }
@ -524,9 +524,8 @@ class LicensesController extends Controller
} }
return redirect()->route('licenses.show', $license->id)->with('error', trans('admin/licenses/message.upload.nofiles')); 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', trans('admin/licenses/message.does_not_exist'));
return redirect()->route('licenses.index')->with('error', $error);
} }
@ -562,7 +561,7 @@ class LicensesController extends Controller
} }
// Redirect to the licence management page // 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'));
} }
@ -613,7 +612,7 @@ class LicensesController extends Controller
} }
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'));
} }

View file

@ -213,7 +213,7 @@ class LocationsController extends Controller
return view('locations/view', compact('location')); 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'));
} }
} }

View file

@ -43,7 +43,7 @@ class StatuslabelsController extends Controller
return view('statuslabels.view')->with('statuslabel', $statuslabel); 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'));
} }

View file

@ -195,11 +195,8 @@ class SuppliersController extends Controller
if (isset($supplier->id)) { if (isset($supplier->id)) {
return view('suppliers/view', compact('supplier')); 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', trans('admin/suppliers/message.does_not_exist'));
return redirect()->route('suppliers.index')->with('error', $error);
} }
} }

View file

@ -606,10 +606,12 @@ class UsersController extends Controller
*/ */
public function show($userId = null) public function show($userId = null)
{ {
if(!$user = User::with('assets', 'assets.model', 'consumables', 'accessories', 'licenses', 'userloc')->withTrashed()->find($userId)) { if (!$user = User::with('assets', 'assets.model', 'consumables', 'accessories', 'licenses', 'userloc')
$error = trans('admin/users/message.user_not_found', compact('id')); ->withTrashed()
// Redirect to the user management page ->find($userId))
return redirect()->route('users.index')->with('error', $error); {
return redirect()->route('users.index')->with('error', trans('admin/users/message.user_not_found', ['id' => $userId]));
} }
$userlog = $user->userlog->load('item'); $userlog = $user->userlog->load('item');
@ -706,10 +708,8 @@ class UsersController extends Controller
->with('userGroups', $userGroups) ->with('userGroups', $userGroups)
->with('clone_user', $user_to_clone); ->with('clone_user', $user_to_clone);
} catch (UserNotFoundException $e) { } catch (UserNotFoundException $e) {
// Prepare the error message
$error = trans('admin/users/message.user_not_found', compact('id')); return redirect()->route('users.index')->with('error', trans('admin/users/message.user_not_found'));
// Redirect to the user management page
return redirect()->route('users.index')->with('error', $error);
} }
} }
@ -790,10 +790,8 @@ class UsersController extends Controller
$log->delete(); $log->delete();
return redirect()->back()->with('success', trans('admin/users/message.deletefile.success')); 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')); return redirect()->route('users.index')->with('error', trans('admin/users/message.does_not_exist'));
// Redirect to the licence management page
return redirect()->route('users.index')->with('error', $error);
} }