File tree Expand file tree Collapse file tree 3 files changed +47
-7
lines changed
bootstrap-4/components/table
bootstrap-5/components/table
tailwind/components/table Expand file tree Collapse file tree 3 files changed +47
-7
lines changed Original file line number Diff line number Diff line change 6
6
' text' => null ,
7
7
] )
8
8
9
+ @php
10
+ $headerAttributesList = [];
11
+ $headerAttributesList [] = [' class' => $attributes -> get (' class' )];
12
+ $headerAttributesList [] = $attributes -> get (' extraAttributes' ) ?? [];
13
+
14
+ $headerAttributes = ' ' ;
15
+ collect ($headerAttributesList )-> each (function ($item ) use (& $headerAttributes ) {
16
+ if (count ($item )) {
17
+ $headerAttributes .= collect ($item )-> map (fn ($value , $key ) => $key . ' ="' . $value . ' "' )-> implode (' ' );
18
+ }
19
+ });
20
+
21
+ @endphp
22
+
9
23
@unless ($sortingEnabled && $sortable )
10
- <th {{ $attributes -> only ( ' class ' ) } } >
24
+ <th {!! $headerAttributes ! ! } >
11
25
{{ $text ?? $slot } }
12
26
</th >
13
27
@else
14
28
<th
15
29
wire:click =" sortBy('{{ $column } } ', '{{ $text ?? $column } } ')"
16
- {{ $attributes -> only ( ' class ' ) } }
30
+ {!! $headerAttributes ! ! }
17
31
style =" cursor :pointer ;"
18
32
>
19
33
<div class =" d-flex align-items-center" >
Original file line number Diff line number Diff line change 6
6
' text' => null ,
7
7
] )
8
8
9
+ @php
10
+ $headerAttributesList = [];
11
+ $headerAttributesList [] = [' class' => $attributes -> get (' class' )];
12
+ $headerAttributesList [] = $attributes -> get (' extraAttributes' ) ?? [];
13
+
14
+ $headerAttributes = ' ' ;
15
+ collect ($headerAttributesList )-> each (function ($item ) use (& $headerAttributes ) {
16
+ if (count ($item )) {
17
+ $headerAttributes .= collect ($item )-> map (fn ($value , $key ) => $key . ' ="' . $value . ' "' )-> implode (' ' );
18
+ }
19
+ });
20
+
21
+ @endphp
22
+
9
23
@unless ($sortingEnabled && $sortable )
10
- <th {{ $attributes -> only ( ' class ' ) } } >
24
+ <th {!! $headerAttributes ! ! } >
11
25
{{ $text ?? $slot } }
12
26
</th >
13
27
@else
14
28
<th
15
29
wire:click =" sortBy('{{ $column } } ', '{{ $text ?? $column } } ')"
16
- {{ $attributes -> only ( ' class ' ) } }
30
+ {!! $headerAttributes ! ! }
17
31
style =" cursor :pointer ;"
18
32
>
19
33
<div class =" d-flex align-items-center" >
Original file line number Diff line number Diff line change 6
6
' text' => null ,
7
7
] )
8
8
9
- <th
10
- {{ $attributes -> merge ([' class' => ' px-3 py-2 md:px-6 md:py-3 bg-gray-50' ])-> only (' class' ) } }
11
- >
9
+ @php
10
+ $headerAttributesList = [];
11
+ $headerAttributesList [] = [' class' => ' px-3 py-2 md:px-6 md:py-3 bg-gray-50 ' . $attributes -> get (' class' )];
12
+ $headerAttributesList [] = $attributes -> get (' extraAttributes' ) ?? [];
13
+
14
+ $headerAttributes = ' ' ;
15
+ collect ($headerAttributesList )-> each (function ($item ) use (& $headerAttributes ) {
16
+ if (count ($item )) {
17
+ $headerAttributes .= collect ($item )-> map (fn ($value , $key ) => $key . ' ="' . $value . ' "' )-> implode (' ' );
18
+ }
19
+ });
20
+
21
+ @endphp
22
+
23
+ <th {!! $headerAttributes ! !} >
12
24
@unless ($sortingEnabled && $sortable )
13
25
<span class =" block text-left text-xs leading-4 font-medium text-gray-500 uppercase tracking-wider" >
14
26
{{ $text ?? $slot } }
You can’t perform that action at this time.
0 commit comments