File tree Expand file tree Collapse file tree 4 files changed +34
-6
lines changed
Expand file tree Collapse file tree 4 files changed +34
-6
lines changed Original file line number Diff line number Diff line change 1818 "require" : {
1919 "php" : " ^8.1" ,
2020 "ext-json" : " *" ,
21- "yajra/laravel-datatables-oracle" : " ^10.0" ,
22- "laravelcollective/html" : " ^6.3.0"
21+ "yajra/laravel-datatables-oracle" : " ^10.0"
2322 },
2423 "require-dev" : {
2524 "nunomaduro/larastan" : " ^2.4" ,
Original file line number Diff line number Diff line change 22
33namespace Yajra \DataTables \Html ;
44
5- use Collective \Html \HtmlBuilder ;
5+ use Yajra \ DataTables \Html \HtmlBuilder ;
66use Illuminate \Contracts \Config \Repository ;
77use Illuminate \Contracts \View \Factory ;
88use Illuminate \Support \Collection ;
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Yajra \DataTables \Html ;
4+
5+ class HtmlBuilder
6+ {
7+ public function attributes (array $ attributes ): string
8+ {
9+ $ html = [];
10+ foreach ($ attributes as $ key => $ value ) {
11+ $ element = $ this ->attributeElement ($ key , $ value );
12+ if (! is_null ($ element )) {
13+ $ html [] = $ element ;
14+ }
15+ }
16+
17+ return count ($ html ) > 0 ? ' ' .implode (' ' , $ html ) : '' ;
18+ }
19+
20+ private function attributeElement (int |string $ key , mixed $ value ): ?string
21+ {
22+ if (is_numeric ($ key )) {
23+ $ key = $ value ;
24+ }
25+
26+ if (! is_null ($ value )) {
27+ return $ key .'=" ' .e ($ value ).'" ' ;
28+ }
29+
30+ return null ;
31+ }
32+ }
Original file line number Diff line number Diff line change 22
33namespace Yajra \DataTables ;
44
5- use Collective \Html \HtmlServiceProvider as CollectiveHtml ;
65use Illuminate \Support \ServiceProvider ;
76
87class HtmlServiceProvider extends ServiceProvider
@@ -41,8 +40,6 @@ public function register(): void
4140 {
4241 $ this ->mergeConfigFrom (__DIR__ .'/resources/config/config.php ' , 'datatables-html ' );
4342
44- $ this ->app ->register (CollectiveHtml::class);
45-
4643 $ this ->app ->bind ('datatables.html ' , function () {
4744 return $ this ->app ->make (Html \Builder::class);
4845 });
You can’t perform that action at this time.
0 commit comments