66
77trait HasTable
88{
9- /**
10- * Retrieves HTML table attribute value.
11- *
12- * @param string $attribute
13- * @return string
14- */
15- public function getTableAttribute (string $ attribute ): string
16- {
17- return $ this ->tableAttributes [$ attribute ] ?? '' ;
18- }
9+ protected ?string $ theadClass = null ;
1910
2011 /**
2112 * Get table computed table attributes.
@@ -38,16 +29,6 @@ public function setTableId(string $id): static
3829 return $ this ->setTableAttribute ('id ' , $ id );
3930 }
4031
41- /**
42- * Get HTML table "id" attribute.
43- *
44- * @return string
45- */
46- public function getTableId (): string
47- {
48- return $ this ->getTableAttribute ('id ' );
49- }
50-
5132 /**
5233 * Sets HTML table attribute(s).
5334 *
@@ -81,6 +62,27 @@ public function setTableAttributes(array $attributes): static
8162 return $ this ;
8263 }
8364
65+ /**
66+ * Get HTML table "id" attribute.
67+ *
68+ * @return string
69+ */
70+ public function getTableId (): string
71+ {
72+ return $ this ->getTableAttribute ('id ' );
73+ }
74+
75+ /**
76+ * Retrieves HTML table attribute value.
77+ *
78+ * @param string $attribute
79+ * @return string
80+ */
81+ public function getTableAttribute (string $ attribute ): string
82+ {
83+ return $ this ->tableAttributes [$ attribute ] ?? '' ;
84+ }
85+
8486 /**
8587 * Add class names to the "class" attribute of HTML table.
8688 *
@@ -98,6 +100,19 @@ public function addTableClass(array|string $class): static
98100 return $ this ->setTableAttribute ('class ' , $ class );
99101 }
100102
103+ /**
104+ * Set table > thead class names.
105+ *
106+ * @param string $class
107+ * @return $this
108+ */
109+ public function setTableHeadClass (string $ class ): static
110+ {
111+ $ this ->theadClass = " class= \"$ class \"" ;
112+
113+ return $ this ;
114+ }
115+
101116 /**
102117 * Remove class names from the "class" attribute of HTML table.
103118 *
0 commit comments