File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change 3
3
namespace Yajra \DataTables \Html \Options \Plugins ;
4
4
5
5
use Illuminate \Contracts \Support \Arrayable ;
6
+ use Yajra \DataTables \Html \Button ;
6
7
7
8
/**
8
9
* DataTables - Buttons plugin option builder.
@@ -34,6 +35,17 @@ public function buttons(...$buttons): static
34
35
return $ this ;
35
36
}
36
37
38
+ /**
39
+ * @param \Yajra\DataTables\Html\Button $button
40
+ * @return $this
41
+ */
42
+ public function addButton (Button $ button ): static
43
+ {
44
+ $ this ->attributes ['buttons ' ][] = $ button ->toArray ();
45
+
46
+ return $ this ;
47
+ }
48
+
37
49
/**
38
50
* Get builder buttons.
39
51
*
Original file line number Diff line number Diff line change @@ -56,11 +56,11 @@ public function it_has_buttons_plugin()
56
56
$ this ->assertCount (2 , $ builder ->getButtons ());
57
57
$ this ->assertIsArray ($ builder ->getButtons ()[0 ]);
58
58
59
- $ builder ->buttons ([
60
- Button::make ('remove ' ),
61
- ]);
62
-
59
+ $ builder ->buttons ([Button::make ('remove ' )]);
63
60
$ this ->assertCount (1 , $ builder ->getButtons ());
61
+
62
+ $ builder ->addButton (Button::make ('edit ' ));
63
+ $ this ->assertCount (2 , $ builder ->getButtons ());
64
64
}
65
65
66
66
/** @test */
You can’t perform that action at this time.
0 commit comments