3
0
mirror of https://github.com/snipe/snipe-it.git synced 2026-02-06 05:25:40 +00:00

Fixed compact() errors

This commit is contained in:
snipe
2020-04-07 17:26:56 -07:00
parent b7d9790acb
commit 0b3f511534
10 changed files with 24 additions and 38 deletions

View File

@ -606,10 +606,12 @@ class UsersController extends Controller
*/
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');
@ -706,10 +708,8 @@ class UsersController extends Controller
->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'));
}
}
@ -790,10 +790,8 @@ class UsersController extends Controller
$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'));
}