1 | <?php |
||
15 | class EloquentEngine extends QueryBuilderEngine |
||
16 | { |
||
17 | /** |
||
18 | * Select trashed records in count function for models with soft deletes trait. |
||
19 | * By default we do not select soft deleted records. |
||
20 | * |
||
21 | * @var bool |
||
22 | */ |
||
23 | protected $withTrashed = false; |
||
24 | |||
25 | /** |
||
26 | * Select only trashed records in count function for models with soft deletes trait. |
||
27 | * By default we do not select soft deleted records. |
||
28 | * |
||
29 | * @var bool |
||
30 | */ |
||
31 | protected $onlyTrashed = false; |
||
32 | |||
33 | /** |
||
34 | * EloquentEngine constructor. |
||
35 | * |
||
36 | * @param mixed $model |
||
37 | * @param \Yajra\Datatables\Request $request |
||
38 | */ |
||
39 | public function __construct($model, Request $request) |
||
46 | |||
47 | /** |
||
48 | * Counts current query. |
||
49 | * |
||
50 | * @return int |
||
51 | */ |
||
52 | public function count() |
||
72 | |||
73 | /** |
||
74 | * Check if builder query uses complex sql. |
||
75 | * |
||
76 | * @param \Illuminate\Database\Eloquent\Builder $builder |
||
77 | * @return bool |
||
78 | */ |
||
79 | private function isComplexQuery($builder) |
||
83 | |||
84 | /** |
||
85 | * Check if engine uses soft deletes. |
||
86 | * |
||
87 | * @return bool |
||
88 | */ |
||
89 | private function isSoftDeleting() |
||
93 | |||
94 | /** |
||
95 | * Check if model use SoftDeletes trait. |
||
96 | * |
||
97 | * @return boolean |
||
98 | */ |
||
99 | private function modelUseSoftDeletes() |
||
103 | |||
104 | /** |
||
105 | * Check if engine uses only trashed. |
||
106 | * |
||
107 | * @return bool |
||
108 | */ |
||
109 | private function isOnlyTrashed() |
||
113 | |||
114 | /** |
||
115 | * Change withTrashed flag value. |
||
116 | * |
||
117 | * @param bool $withTrashed |
||
118 | * @return $this |
||
119 | */ |
||
120 | public function withTrashed($withTrashed = true) |
||
126 | |||
127 | /** |
||
128 | * Change onlyTrashed flag value. |
||
129 | * |
||
130 | * @param bool $onlyTrashed |
||
131 | * @return $this |
||
132 | */ |
||
133 | public function onlyTrashed($onlyTrashed = true) |
||
139 | |||
140 | /** |
||
141 | * If column name could not be resolved then use primary key. |
||
142 | * |
||
143 | * @return string |
||
144 | */ |
||
145 | protected function getPrimaryKeyName() |
||
149 | } |
||
150 |
If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:
If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.