From 6b687fd5129f9cb918937ac7812a0eb275f00192 Mon Sep 17 00:00:00 2001 From: Orlyapps Date: Sat, 29 Jan 2022 14:38:53 +0100 Subject: [PATCH] limit badge labels --- src/Fields/WorkflowBadge.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Fields/WorkflowBadge.php b/src/Fields/WorkflowBadge.php index 0443de4..47d2a32 100644 --- a/src/Fields/WorkflowBadge.php +++ b/src/Fields/WorkflowBadge.php @@ -22,6 +22,15 @@ public function __construct($name, $className) $this->labels($className::statusLabels()); } + public function limit($limit = 5) + { + foreach ($this->labels as $key => $value) { + $this->labels[$key] = \Str::limit($value, $limit); + } + + return $this; + } + /** * The built-in badge types and their corresponding CSS classes. *