1 | <?php |
||
18 | class Builder |
||
19 | { |
||
20 | /** |
||
21 | * @var Collection |
||
22 | */ |
||
23 | public $collection; |
||
24 | |||
25 | /** |
||
26 | * @var Repository |
||
27 | */ |
||
28 | public $config; |
||
29 | |||
30 | /** |
||
31 | * @var Factory |
||
32 | */ |
||
33 | public $view; |
||
34 | |||
35 | /** |
||
36 | * @var HtmlBuilder |
||
37 | */ |
||
38 | public $html; |
||
39 | |||
40 | /** |
||
41 | * @var UrlGenerator |
||
42 | */ |
||
43 | public $url; |
||
44 | |||
45 | /** |
||
46 | * @var FormBuilder |
||
47 | */ |
||
48 | public $form; |
||
49 | |||
50 | /** |
||
51 | * @var string|array |
||
52 | */ |
||
53 | protected $ajax = ''; |
||
54 | |||
55 | /** |
||
56 | * @var array |
||
57 | */ |
||
58 | protected $tableAttributes = ['class' => 'table', 'id' => 'dataTableBuilder']; |
||
59 | |||
60 | /** |
||
61 | * @var string |
||
62 | */ |
||
63 | protected $template = ''; |
||
64 | |||
65 | /** |
||
66 | * @var array |
||
67 | */ |
||
68 | protected $attributes = []; |
||
69 | |||
70 | /** |
||
71 | * @param Repository $config |
||
72 | * @param Factory $view |
||
73 | * @param HtmlBuilder $html |
||
74 | * @param UrlGenerator $url |
||
75 | * @param FormBuilder $form |
||
76 | */ |
||
77 | public function __construct( |
||
91 | |||
92 | /** |
||
93 | * Generate DataTable javascript. |
||
94 | * |
||
95 | * @param null $script |
||
96 | * @param array $attributes |
||
97 | * @return string |
||
98 | */ |
||
99 | public function scripts($script = null, array $attributes = ['type' => 'text/javascript']) |
||
105 | |||
106 | /** |
||
107 | * Get generated raw scripts. |
||
108 | * |
||
109 | * @return string |
||
110 | */ |
||
111 | public function generateScripts() |
||
127 | |||
128 | /** |
||
129 | * Generate datatable js parameters. |
||
130 | * |
||
131 | * @param array $attributes |
||
132 | * @return string |
||
133 | */ |
||
134 | public function parameterize($attributes = []) |
||
157 | |||
158 | /** |
||
159 | * Get javascript template to use. |
||
160 | * |
||
161 | * @return string |
||
162 | */ |
||
163 | protected function template() |
||
169 | |||
170 | /** |
||
171 | * Add a column in collection using attributes. |
||
172 | * |
||
173 | * @param array $attributes |
||
174 | * @return $this |
||
175 | */ |
||
176 | public function addColumn(array $attributes) |
||
182 | |||
183 | /** |
||
184 | * Add a Column object in collection. |
||
185 | * |
||
186 | * @param \Yajra\Datatables\Html\Column $column |
||
187 | * @return $this |
||
188 | */ |
||
189 | public function add(Column $column) |
||
195 | |||
196 | /** |
||
197 | * Set datatables columns from array definition. |
||
198 | * |
||
199 | * @param array $columns |
||
200 | * @return $this |
||
201 | */ |
||
202 | public function columns(array $columns) |
||
220 | |||
221 | /** |
||
222 | * Set title attribute of an array if not set. |
||
223 | * |
||
224 | * @param string $title |
||
225 | * @param array $attributes |
||
226 | * @return array |
||
227 | */ |
||
228 | public function setTitle($title, array $attributes) |
||
236 | |||
237 | /** |
||
238 | * Convert string into a readable title. |
||
239 | * |
||
240 | * @param string $title |
||
241 | * @return string |
||
242 | */ |
||
243 | public function getQualifiedTitle($title) |
||
247 | |||
248 | /** |
||
249 | * Add a checkbox column. |
||
250 | * |
||
251 | * @param array $attributes |
||
252 | * @return $this |
||
253 | */ |
||
254 | public function addCheckbox(array $attributes = []) |
||
273 | |||
274 | /** |
||
275 | * Add a action column. |
||
276 | * |
||
277 | * @param array $attributes |
||
278 | * @return $this |
||
279 | */ |
||
280 | public function addAction(array $attributes = []) |
||
299 | |||
300 | /** |
||
301 | * Setup ajax parameter |
||
302 | * |
||
303 | * @param string|array $attributes |
||
304 | * @return $this |
||
305 | */ |
||
306 | public function ajax($attributes) |
||
312 | |||
313 | /** |
||
314 | * Generate DataTable's table html. |
||
315 | * |
||
316 | * @param array $attributes |
||
317 | * @return string |
||
318 | */ |
||
319 | public function table(array $attributes = []) |
||
325 | |||
326 | /** |
||
327 | * Configure DataTable's parameters. |
||
328 | * |
||
329 | * @param array $attributes |
||
330 | * @return $this |
||
331 | */ |
||
332 | public function parameters(array $attributes = []) |
||
338 | |||
339 | /** |
||
340 | * Set custom javascript template. |
||
341 | * |
||
342 | * @param string $template |
||
343 | * @return $this |
||
344 | */ |
||
345 | public function setTemplate($template) |
||
351 | |||
352 | /** |
||
353 | * Get collection of columns. |
||
354 | * |
||
355 | * @return Collection |
||
356 | */ |
||
357 | public function getColumns() |
||
361 | } |
||
362 |