1 | <?php |
||
13 | trait HasColumns |
||
14 | { |
||
15 | /** |
||
16 | * Set columnDefs option value. |
||
17 | * |
||
18 | * @param array $value |
||
19 | * @return $this |
||
20 | * @see https://datatables.net/reference/option/columnDefs |
||
21 | */ |
||
22 | public function columnDefs(array $value) |
||
28 | |||
29 | /** |
||
30 | * Set columns option value. |
||
31 | * |
||
32 | * @param array $columns |
||
33 | * @return $this |
||
34 | * @see https://datatables.net/reference/option/columns |
||
35 | */ |
||
36 | public function columns(array $columns) |
||
66 | |||
67 | /** |
||
68 | * Add a column in collection usingsl attributes. |
||
69 | * |
||
70 | * @param array $attributes |
||
71 | * @return $this |
||
72 | */ |
||
73 | public function addColumn(array $attributes) |
||
79 | |||
80 | /** |
||
81 | * Add a Column object at the beginning of collection. |
||
82 | * |
||
83 | * @param \Yajra\DataTables\Html\Column $column |
||
84 | * @return $this |
||
85 | */ |
||
86 | public function addBefore(Column $column) |
||
92 | |||
93 | /** |
||
94 | * Add a column at the beginning of collection using attributes. |
||
95 | * |
||
96 | * @param array $attributes |
||
97 | * @return $this |
||
98 | */ |
||
99 | public function addColumnBefore(array $attributes) |
||
105 | |||
106 | /** |
||
107 | * Add a Column object in collection. |
||
108 | * |
||
109 | * @param \Yajra\DataTables\Html\Column $column |
||
110 | * @return $this |
||
111 | */ |
||
112 | public function add(Column $column) |
||
118 | |||
119 | /** |
||
120 | * Get collection of columns. |
||
121 | * |
||
122 | * @return \Illuminate\Support\Collection |
||
123 | */ |
||
124 | public function getColumns() |
||
128 | |||
129 | /** |
||
130 | * Remove column by name. |
||
131 | * |
||
132 | * @param array $names |
||
133 | * @return $this |
||
134 | */ |
||
135 | public function removeColumn(...$names) |
||
145 | } |
||
146 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: