Fixed restore method

This commit is contained in:
snipe 2016-04-21 20:27:03 -07:00
parent 2284a0783f
commit 0a5e7214aa

View file

@ -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