1111
1212class Builder
1313{
14- use Macroable;
15- use HasOptions;
16- use HasTable;
17- use HasEditor;
18- use Columns \Index;
1914 use Columns \Action;
2015 use Columns \Checkbox;
16+ use Columns \Index;
17+ use HasEditor;
18+ use HasOptions;
19+ use HasTable;
20+ use Macroable;
2121
2222 // Select plugin constants.
2323 const SELECT_STYLE_API = 'api ' ;
24+
2425 const SELECT_STYLE_SINGLE = 'single ' ;
26+
2527 const SELECT_STYLE_MULTI = 'multi ' ;
28+
2629 const SELECT_STYLE_OS = 'os ' ;
30+
2731 const SELECT_STYLE_MULTI_SHIFT = 'multi+shift ' ;
32+
2833 const SELECT_ITEMS_ROW = 'row ' ;
34+
2935 const SELECT_ITEMS_COLUMN = 'column ' ;
36+
3037 const SELECT_ITEMS_CELL = 'cell ' ;
3138
3239 /**
@@ -44,31 +51,14 @@ class Builder
4451 */
4552 protected array $ tableAttributes = [];
4653
47- /**
48- * @var string
49- */
5054 protected string $ template = '' ;
5155
52- /**
53- * @var array
54- */
5556 protected array $ attributes = [];
5657
57- /**
58- * @var string|array
59- */
6058 protected string |array $ ajax = '' ;
6159
62- /**
63- * @var array
64- */
6560 protected array $ additionalScripts = [];
6661
67- /**
68- * @param Repository $config
69- * @param Factory $view
70- * @param HtmlBuilder $html
71- */
7262 public function __construct (public Repository $ config , public Factory $ view , public HtmlBuilder $ html )
7363 {
7464 /** @var array $defaults */
@@ -100,12 +90,8 @@ public static function useWebpack(): void
10090
10191 /**
10292 * Generate DataTable javascript.
103- *
104- * @param string|null $script
105- * @param array $attributes
106- * @return \Illuminate\Support\HtmlString
10793 */
108- public function scripts (string $ script = null , array $ attributes = []): HtmlString
94+ public function scripts (? string $ script = null , array $ attributes = []): HtmlString
10995 {
11096 $ script = $ script ?: $ this ->generateScripts ();
11197 $ attributes = $ this ->html ->attributes (
@@ -117,8 +103,6 @@ public function scripts(string $script = null, array $attributes = []): HtmlStri
117103
118104 /**
119105 * Get generated raw scripts.
120- *
121- * @return \Illuminate\Support\HtmlString
122106 */
123107 public function generateScripts (): HtmlString
124108 {
@@ -131,8 +115,6 @@ public function generateScripts(): HtmlString
131115
132116 /**
133117 * Get generated json configuration.
134- *
135- * @return string
136118 */
137119 public function generateJson (): string
138120 {
@@ -141,9 +123,6 @@ public function generateJson(): string
141123
142124 /**
143125 * Generate DataTables js parameters.
144- *
145- * @param array $attributes
146- * @return string
147126 */
148127 public function parameterize (array $ attributes = []): string
149128 {
@@ -154,8 +133,6 @@ public function parameterize(array $attributes = []): string
154133
155134 /**
156135 * Get DataTable options array.
157- *
158- * @return array
159136 */
160137 public function getOptions (): array
161138 {
@@ -174,8 +151,6 @@ public function getOptions(): array
174151
175152 /**
176153 * Get javascript template to use.
177- *
178- * @return string
179154 */
180155 protected function template (): string
181156 {
@@ -189,11 +164,6 @@ protected function template(): string
189164
190165 /**
191166 * Generate DataTable's table html.
192- *
193- * @param array $attributes
194- * @param bool $drawFooter
195- * @param bool $drawSearch
196- * @return \Illuminate\Support\HtmlString
197167 */
198168 public function table (array $ attributes = [], bool $ drawFooter = false , bool $ drawSearch = false ): HtmlString
199169 {
@@ -223,7 +193,6 @@ public function table(array $attributes = [], bool $drawFooter = false, bool $dr
223193 /**
224194 * Configure DataTable's parameters.
225195 *
226- * @param array $attributes
227196 * @return $this
228197 */
229198 public function parameters (array $ attributes = []): static
@@ -246,7 +215,6 @@ public function asOptions(): static
246215 /**
247216 * Set custom javascript template.
248217 *
249- * @param string $template
250218 * @return $this
251219 */
252220 public function setTemplate (string $ template ): static
@@ -266,29 +234,17 @@ public function asFunction(): static
266234 return $ this ->setTemplate ('datatables::function ' );
267235 }
268236
269- /**
270- * @return array
271- */
272237 public function getAttributes (): array
273238 {
274239 return $ this ->attributes ;
275240 }
276241
277- /**
278- * @param string $key
279- * @param mixed $default
280- * @return mixed
281- */
282242 public function getAttribute (string $ key , mixed $ default = '' ): mixed
283243 {
284244 return $ this ->attributes [$ key ] ?? $ default ;
285245 }
286246
287- /**
288- * @param string|null $key
289- * @return array|string
290- */
291- public function getAjax (string $ key = null ): array |string
247+ public function getAjax (?string $ key = null ): array |string
292248 {
293249 if (! is_null ($ key )) {
294250 return $ this ->ajax [$ key ] ?? '' ;
@@ -300,7 +256,6 @@ public function getAjax(string $key = null): array|string
300256 /**
301257 * Add additional scripts to the DataTables JS initialization.
302258 *
303- * @param string $view
304259 * @return $this
305260 */
306261 public function addScript (string $ view ): static
0 commit comments