1 | <?php |
||
11 | class EloquentDataTable extends QueryDataTable |
||
12 | { |
||
13 | /** |
||
14 | * @var \Illuminate\Database\Eloquent\Builder |
||
15 | */ |
||
16 | protected $query; |
||
17 | |||
18 | /** |
||
19 | * EloquentDataTable constructor. |
||
20 | * |
||
21 | * @param mixed $model |
||
22 | */ |
||
23 | public function __construct($model) |
||
30 | |||
31 | /** |
||
32 | * Add columns in collection. |
||
33 | * |
||
34 | * @param array $names |
||
35 | * @param bool|int $order |
||
36 | * @return $this |
||
37 | */ |
||
38 | public function addColumns(array $names, $order = false) |
||
52 | |||
53 | /** |
||
54 | * If column name could not be resolved then use primary key. |
||
55 | * |
||
56 | * @return string |
||
57 | */ |
||
58 | protected function getPrimaryKeyName() |
||
62 | |||
63 | /** |
||
64 | * Compile query builder where clause depending on configurations. |
||
65 | * |
||
66 | * @param mixed $query |
||
67 | * @param string $columnName |
||
68 | * @param string $keyword |
||
69 | * @param string $boolean |
||
70 | */ |
||
71 | protected function compileQuerySearch($query, $columnName, $keyword, $boolean = 'or') |
||
85 | |||
86 | /** |
||
87 | * Resolve the proper column name be used. |
||
88 | * |
||
89 | * @param string $column |
||
90 | * @return string |
||
91 | */ |
||
92 | protected function resolveRelationColumn($column) |
||
104 | |||
105 | /** |
||
106 | * Check if a relation was not used on eager loading. |
||
107 | * |
||
108 | * @param string $relation |
||
109 | * @return bool |
||
110 | */ |
||
111 | protected function isNotEagerLoaded($relation) |
||
117 | |||
118 | /** |
||
119 | * Join eager loaded relation and get the related column name. |
||
120 | * |
||
121 | * @param string $relation |
||
122 | * @param string $relationColumn |
||
123 | * @return string |
||
124 | * @throws \Yajra\DataTables\Exceptions\Exception |
||
125 | */ |
||
126 | protected function joinEagerLoadedColumn($relation, $relationColumn) |
||
171 | |||
172 | /** |
||
173 | * Perform join query. |
||
174 | * |
||
175 | * @param string $table |
||
176 | * @param string $foreign |
||
177 | * @param string $other |
||
178 | * @param string $type |
||
179 | */ |
||
180 | protected function performJoin($table, $foreign, $other, $type = 'left') |
||
191 | } |
||
192 |