zeropad(dechex($value), 6); } /** * Prepare the given value for storage. */ public function set(Model $model, string $key, mixed $value, array $attributes): int { return \intval(hexdec(ltrim($value, '#'))); } /** * Pad with zeros a numeric string */ protected function zeropad(string $num, int $lim): string { return (strlen($num) >= $lim) ? $num : $this->zeropad('0' . $num, $lim); } }