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 = []) |
||
154 | |||
155 | /** |
||
156 | * Get javascript template to use. |
||
157 | * |
||
158 | * @return string |
||
159 | */ |
||
160 | protected function template() |
||
166 | |||
167 | /** |
||
168 | * Add a column in collection using attributes. |
||
169 | * |
||
170 | * @param array $attributes |
||
171 | * @return $this |
||
172 | */ |
||
173 | public function addColumn(array $attributes) |
||
179 | |||
180 | /** |
||
181 | * Add a Column object in collection. |
||
182 | * |
||
183 | * @param \Yajra\Datatables\Html\Column $column |
||
184 | * @return $this |
||
185 | */ |
||
186 | public function add(Column $column) |
||
192 | |||
193 | /** |
||
194 | * Set datatables columns from array definition. |
||
195 | * |
||
196 | * @param array $columns |
||
197 | * @return $this |
||
198 | */ |
||
199 | public function columns(array $columns) |
||
217 | |||
218 | /** |
||
219 | * Set title attribute of an array if not set. |
||
220 | * |
||
221 | * @param string $title |
||
222 | * @param array $attributes |
||
223 | * @return array |
||
224 | */ |
||
225 | public function setTitle($title, array $attributes) |
||
233 | |||
234 | /** |
||
235 | * Convert string into a readable title. |
||
236 | * |
||
237 | * @param string $title |
||
238 | * @return string |
||
239 | */ |
||
240 | public function getQualifiedTitle($title) |
||
244 | |||
245 | /** |
||
246 | * Add a checkbox column. |
||
247 | * |
||
248 | * @param array $attributes |
||
249 | * @return $this |
||
250 | */ |
||
251 | public function addCheckbox(array $attributes = []) |
||
268 | |||
269 | /** |
||
270 | * Add a action column. |
||
271 | * |
||
272 | * @param array $attributes |
||
273 | * @return $this |
||
274 | */ |
||
275 | public function addAction(array $attributes = []) |
||
292 | |||
293 | /** |
||
294 | * Setup ajax parameter |
||
295 | * |
||
296 | * @param string|array $attributes |
||
297 | * @return $this |
||
298 | */ |
||
299 | public function ajax($attributes) |
||
305 | |||
306 | /** |
||
307 | * Generate DataTable's table html. |
||
308 | * |
||
309 | * @param array $attributes |
||
310 | * @return string |
||
311 | */ |
||
312 | public function table(array $attributes = []) |
||
318 | |||
319 | /** |
||
320 | * Configure DataTable's parameters. |
||
321 | * |
||
322 | * @param array $attributes |
||
323 | * @return $this |
||
324 | */ |
||
325 | public function parameters(array $attributes = []) |
||
331 | |||
332 | /** |
||
333 | * Set custom javascript template. |
||
334 | * |
||
335 | * @param string $template |
||
336 | * @return $this |
||
337 | */ |
||
338 | public function setTemplate($template) |
||
344 | } |
||
345 |