1 | <?php |
||
12 | class EloquentDataTable extends QueryDataTable |
||
13 | { |
||
14 | /** |
||
15 | * @var \Illuminate\Database\Eloquent\Builder |
||
16 | */ |
||
17 | protected $query; |
||
18 | |||
19 | /** |
||
20 | * Can the DataTable engine be created with these parameters. |
||
21 | * |
||
22 | * @param mixed $source |
||
23 | * @return boolean |
||
24 | */ |
||
25 | public static function canCreate($source) |
||
29 | |||
30 | /** |
||
31 | * EloquentEngine constructor. |
||
32 | * |
||
33 | * @param mixed $model |
||
34 | */ |
||
35 | public function __construct($model) |
||
42 | |||
43 | /** |
||
44 | * Add columns in collection. |
||
45 | * |
||
46 | * @param array $names |
||
47 | * @param bool|int $order |
||
48 | * @return $this |
||
49 | */ |
||
50 | public function addColumns(array $names, $order = false) |
||
64 | |||
65 | /** |
||
66 | * If column name could not be resolved then use primary key. |
||
67 | * |
||
68 | * @return string |
||
69 | */ |
||
70 | protected function getPrimaryKeyName() |
||
74 | |||
75 | /** |
||
76 | * Compile query builder where clause depending on configurations. |
||
77 | * |
||
78 | * @param mixed $query |
||
79 | * @param string $columnName |
||
80 | * @param string $keyword |
||
81 | * @param string $boolean |
||
82 | */ |
||
83 | protected function compileQuerySearch($query, $columnName, $keyword, $boolean = 'or') |
||
97 | |||
98 | /** |
||
99 | * Resolve the proper column name be used. |
||
100 | * |
||
101 | * @param string $column |
||
102 | * @return string |
||
103 | */ |
||
104 | protected function resolveRelationColumn($column) |
||
116 | |||
117 | /** |
||
118 | * Check if a relation was not used on eager loading. |
||
119 | * |
||
120 | * @param string $relation |
||
121 | * @return bool |
||
122 | */ |
||
123 | protected function isNotEagerLoaded($relation) |
||
129 | |||
130 | /** |
||
131 | * Join eager loaded relation and get the related column name. |
||
132 | * |
||
133 | * @param string $relation |
||
134 | * @param string $relationColumn |
||
135 | * @return string |
||
136 | * @throws \Yajra\DataTables\Exceptions\Exception |
||
137 | */ |
||
138 | protected function joinEagerLoadedColumn($relation, $relationColumn) |
||
183 | |||
184 | /** |
||
185 | * Perform join query. |
||
186 | * |
||
187 | * @param string $table |
||
188 | * @param string $foreign |
||
189 | * @param string $other |
||
190 | * @param string $type |
||
191 | */ |
||
192 | protected function performJoin($table, $foreign, $other, $type = 'left') |
||
203 | } |
||
204 |