public function check($form, $jsonInput = false)
    {
        $result = [];
        $errors = [];
        $inputs = [];

        if (is_array($form)) {
            $fields = $form;
        } else {
            $conditions = Cms::config('validation.'.$form);
            $fields = $conditions;
        }

        if (!is_array($fields)) {
            $fields = [$fields];
        }

        $validationRules = $validationInputs = [];

        foreach ($fields as $key => $value) {
            if (isset($fields[$key])) {
                $inputs[$key] = $this->getInput($key, $jsonInput);
                $validationInputs[$key] = $this->getInput($key, $jsonInput);
                $validationRules[$key] = $fields[$key];
            }
        }

        $validation = Validator::make($validationInputs, $validationRules);

        if ($validation->fails()) {
            $errors = $validation->messages();
        }

        if (!$jsonInput) {
            $result['redirect'] = Redirect::back()->with('errors', $errors)->with('inputs', $this->inputsArray($jsonInput));
        }

        if (!empty($errors)) {
            $result['errors'] = $errors;
        } else {
            $result['errors'] = false;
        }

        $result['inputs'] = $this->inputsArray($jsonInput);

        return $result;
    }