App\Http\Controllers\UserController::bulk PHP Method

bulk() public method

public bulk ( )
    public function bulk()
    {
        $action = Input::get('bulk_action');
        $id = Input::get('bulk_public_id');
        $user = User::where('account_id', '=', Auth::user()->account_id)->where('public_id', '=', $id)->withTrashed()->firstOrFail();
        if ($action === 'archive') {
            $user->delete();
        } else {
            if (!Auth::user()->caddAddUsers()) {
                return Redirect::to('settings/' . ACCOUNT_USER_MANAGEMENT)->with('error', trans('texts.max_users_reached'));
            }
            $user->restore();
        }
        Session::flash('message', trans("texts.{$action}d_user"));
        return Redirect::to('settings/' . ACCOUNT_USER_MANAGEMENT);
    }