/** * Get the size of an attribute. * * @param string $attribute * @param mixed $value * @return mixed */ protected function size($attribute, $value) { // This method will determine if the attribute is a number, string, or file and // return the proper size accordingly. If it is a number, then number itself is // the size; if it is a file, the size is kilobytes in the size; if it is a // string, the length is the size. if (is_numeric($value) and $this->has_rule($attribute, $this->numeric_rules)) { return $this->attributes[$attribute]; } elseif (array_key_exists($attribute, Input::file())) { return $value['size'] / 1024; } else { return Str::length(trim($value)); } }
/** * Get the size of an attribute. * * This method will determine if the attribute is a number, string, or file and * return the proper size accordingly. If it is a number, then number itself is * the size; if it is a file, the size is kilobytes in the size; if it is a * string, the length is the size. * * @param string $attribute * @param mixed $value * @return mixed */ protected function size($attribute, $value) { if (is_numeric($value) and $this->has_rule($attribute, $this->numeric_rules)) { return $this->attributes[$attribute]; } elseif (array_key_exists($attribute, Input::file())) { return $value['size'] / 1024; } else { return Str::length(trim($value)); } }