mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-10 07:34:06 -08:00
Fixed restore method
This commit is contained in:
parent
2284a0783f
commit
0a5e7214aa
|
@ -497,19 +497,16 @@ class UsersController extends Controller
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
// Get user information
|
// Get user information
|
||||||
//$user = Sentry::getUserProvider()->createModel()->withTrashed()->find($id);
|
if (!$user = User::withTrashed()->find($id)) {
|
||||||
|
return Redirect::route('users')->with('error', trans('admins/users/messages.user_not_found'));
|
||||||
|
}
|
||||||
|
|
||||||
if (!Company::isCurrentUserHasAccess($user)) {
|
if (!Company::isCurrentUserHasAccess($user)) {
|
||||||
return Redirect::route('users')->with('error', trans('general.insufficient_permissions'));
|
return Redirect::route('users')->with('error', trans('general.insufficient_permissions'));
|
||||||
} else {
|
} else {
|
||||||
// Restore the user
|
// Restore the user
|
||||||
$user->restore();
|
$user->restore();
|
||||||
|
return Redirect::route('users')->with('success', trans('admin/users/message.success.restored'));
|
||||||
// Prepare the success message
|
|
||||||
$success = trans('admin/users/message.success.restored');
|
|
||||||
|
|
||||||
// Redirect to the user management page
|
|
||||||
return Redirect::route('users')->with('success', $success);
|
|
||||||
}
|
}
|
||||||
} catch (UserNotFoundException $e) {
|
} catch (UserNotFoundException $e) {
|
||||||
// Prepare the error message
|
// Prepare the error message
|
||||||
|
|
Loading…
Reference in a new issue