summaryrefslogtreecommitdiff
path: root/src/Concerns
diff options
context:
space:
mode:
Diffstat (limited to 'src/Concerns')
-rw-r--r--src/Concerns/WithAttributes.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/Concerns/WithAttributes.php b/src/Concerns/WithAttributes.php
new file mode 100644
index 0000000..5b77fa5
--- /dev/null
+++ b/src/Concerns/WithAttributes.php
@@ -0,0 +1,22 @@
+<?php
+
+namespace Lightscale\LaralightTables\Concerns;
+
+use Illuminate\View\ComponentAttributeBag;
+
+trait WithAttributes
+{
+ protected ?array $attributes = null;
+
+ public function attributes(array $attributes): static
+ {
+ $this->attributes = $attributes;
+ return $this;
+ }
+
+ protected function getAttributes(): ComponentAttributeBag
+ {
+ return new ComponentAttributeBag($this->attributes ?? []);
+ }
+
+}