These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Encore\Admin\Actions; |
||
4 | |||
5 | use Encore\Admin\Grid; |
||
6 | use Illuminate\Database\Eloquent\SoftDeletes; |
||
7 | use Illuminate\Http\Request; |
||
8 | |||
9 | /** |
||
10 | * Class GridAction. |
||
11 | * |
||
12 | * @method retrieveModel(Request $request) |
||
13 | */ |
||
14 | abstract class GridAction extends Action |
||
15 | { |
||
16 | /** |
||
17 | * @var Grid |
||
18 | */ |
||
19 | protected $parent; |
||
20 | |||
21 | /** |
||
22 | * @var string |
||
23 | */ |
||
24 | public $selectorPrefix = '.grid-action-'; |
||
25 | |||
26 | /** |
||
27 | * @param Grid $grid |
||
28 | * |
||
29 | * @return $this |
||
30 | */ |
||
31 | public function setGrid(Grid $grid) |
||
32 | { |
||
33 | $this->parent = $grid; |
||
34 | |||
35 | return $this; |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * Get url path of current resource. |
||
40 | * |
||
41 | * @return string |
||
42 | */ |
||
43 | public function getResource() |
||
44 | { |
||
45 | return $this->parent->resource(); |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @return mixed |
||
50 | */ |
||
51 | protected function getModelClass() |
||
52 | { |
||
53 | $model = $this->parent->model()->getOriginalModel(); |
||
0 ignored issues
–
show
|
|||
54 | |||
55 | return str_replace('\\', '_', get_class($model)); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * @return array |
||
60 | */ |
||
61 | public function parameters() |
||
62 | { |
||
63 | return ['_model' => $this->getModelClass()]; |
||
64 | } |
||
65 | |||
66 | /** |
||
67 | * Indicates if model uses soft-deletes. |
||
68 | * |
||
69 | * @param $modelClass |
||
70 | * |
||
71 | * @return bool |
||
72 | */ |
||
73 | protected function modelUseSoftDeletes($modelClass) |
||
74 | { |
||
75 | return in_array(SoftDeletes::class, class_uses_deep($modelClass)); |
||
76 | } |
||
77 | } |
||
78 |
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: