| 1 | <?php |
||
| 5 | trait DatatableStateTrait |
||
| 6 | { |
||
| 7 | /** |
||
| 8 | * Datatable (injected by the constructor). |
||
| 9 | * |
||
| 10 | * @var \Distilleries\DatatableBuilder\EloquentDatatable $datatable |
||
| 11 | */ |
||
| 12 | protected $datatable; |
||
| 13 | |||
| 14 | /** |
||
| 15 | * Model (injected by the contructor). |
||
| 16 | * |
||
| 17 | * @var \Illuminate\Database\Eloquent\Model $model |
||
| 18 | */ |
||
| 19 | protected $model; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * View to display datatable. |
||
| 23 | * |
||
| 24 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View |
||
| 25 | */ |
||
| 26 | 8 | public function getIndexDatatable() |
|
| 35 | |||
| 36 | /** |
||
| 37 | * Return generated datatable. |
||
| 38 | * |
||
| 39 | * @return mixed |
||
| 40 | */ |
||
| 41 | 4 | public function getDatatable() |
|
| 48 | } |
||
| 49 |
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: