1 | <?php |
||
14 | class EloquentEngine extends QueryBuilderEngine |
||
15 | { |
||
16 | /** |
||
17 | * Select trashed records in count function for models with soft deletes trait. |
||
18 | * By default we do not select soft deleted records. |
||
19 | * |
||
20 | * @var bool |
||
21 | */ |
||
22 | protected $withTrashed = false; |
||
23 | |||
24 | /** |
||
25 | * Select only trashed records in count function for models with soft deletes trait. |
||
26 | * By default we do not select soft deleted records. |
||
27 | * |
||
28 | * @var bool |
||
29 | */ |
||
30 | protected $onlyTrashed = false; |
||
31 | |||
32 | /** |
||
33 | * @var \Illuminate\Database\Eloquent\Builder |
||
34 | */ |
||
35 | protected $query; |
||
36 | |||
37 | /** |
||
38 | * EloquentEngine constructor. |
||
39 | * |
||
40 | * @param mixed $model |
||
41 | * @param \Yajra\Datatables\Request $request |
||
42 | */ |
||
43 | public function __construct($model, Request $request) |
||
50 | |||
51 | /** |
||
52 | * Counts current query. |
||
53 | * |
||
54 | * @return int |
||
55 | */ |
||
56 | public function count() |
||
74 | |||
75 | /** |
||
76 | * Check if engine uses soft deletes. |
||
77 | * |
||
78 | * @return bool |
||
79 | */ |
||
80 | private function isSoftDeleting() |
||
84 | |||
85 | /** |
||
86 | * Check if model use SoftDeletes trait. |
||
87 | * |
||
88 | * @return boolean |
||
89 | */ |
||
90 | private function modelUseSoftDeletes() |
||
94 | |||
95 | /** |
||
96 | * Check if engine uses only trashed. |
||
97 | * |
||
98 | * @return bool |
||
99 | */ |
||
100 | private function isOnlyTrashed() |
||
104 | |||
105 | /** |
||
106 | * Change withTrashed flag value. |
||
107 | * |
||
108 | * @param bool $withTrashed |
||
109 | * @return $this |
||
110 | */ |
||
111 | public function withTrashed($withTrashed = true) |
||
117 | |||
118 | /** |
||
119 | * Change onlyTrashed flag value. |
||
120 | * |
||
121 | * @param bool $onlyTrashed |
||
122 | * @return $this |
||
123 | */ |
||
124 | public function onlyTrashed($onlyTrashed = true) |
||
130 | |||
131 | /** |
||
132 | * If column name could not be resolved then use primary key. |
||
133 | * |
||
134 | * @return string |
||
135 | */ |
||
136 | protected function getPrimaryKeyName() |
||
140 | |||
141 | /** |
||
142 | * Perform global search for the given keyword. |
||
143 | * |
||
144 | * @param string $keyword |
||
145 | */ |
||
146 | protected function globalSearch($keyword) |
||
171 | |||
172 | /** |
||
173 | * Perform search on eager loaded relation column. |
||
174 | * |
||
175 | * @param \Illuminate\Database\Eloquent\Builder $query |
||
176 | * @param string $columnName |
||
177 | * @param string $keyword |
||
178 | */ |
||
179 | private function eagerLoadSearch($query, $columnName, $keyword) |
||
196 | |||
197 | /** |
||
198 | * Add relation query on global search. |
||
199 | * |
||
200 | * @param mixed $query |
||
201 | * @param string $relation |
||
202 | * @param string $column |
||
203 | * @param string $keyword |
||
204 | */ |
||
205 | private function compileRelationSearch($query, $relation, $column, $keyword) |
||
295 | } |
||
296 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: