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 33namespace Yajra \DataTables \Html \Options \Plugins ;
44
55use Illuminate \Contracts \Support \Arrayable ;
6+ use Yajra \DataTables \Html \Button ;
67
78/**
89 * DataTables - Buttons plugin option builder.
@@ -34,6 +35,17 @@ public function buttons(...$buttons): static
3435 return $ this ;
3536 }
3637
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+
3749 /**
3850 * Get builder buttons.
3951 *
Original file line number Diff line number Diff line change @@ -56,11 +56,11 @@ public function it_has_buttons_plugin()
5656 $ this ->assertCount (2 , $ builder ->getButtons ());
5757 $ this ->assertIsArray ($ builder ->getButtons ()[0 ]);
5858
59- $ builder ->buttons ([
60- Button::make ('remove ' ),
61- ]);
62-
59+ $ builder ->buttons ([Button::make ('remove ' )]);
6360 $ this ->assertCount (1 , $ builder ->getButtons ());
61+
62+ $ builder ->addButton (Button::make ('edit ' ));
63+ $ this ->assertCount (2 , $ builder ->getButtons ());
6464 }
6565
6666 /** @test */
You can’t perform that action at this time.
0 commit comments