1 | <?php |
||
10 | class ModelLogController extends Controller |
||
11 | { |
||
12 | private $actions = ['update', 'delete', 'create']; |
||
13 | |||
14 | 2 | public function index(Request $request) |
|
23 | |||
24 | 3 | public function applyFilters(Builder $modelLogs, $request) : Builder |
|
25 | { |
||
26 | 3 | if ($request->created_before) { |
|
27 | 1 | $modelLogs->where('created_at', '<', Carbon::parse($request->created_before)); |
|
28 | } |
||
29 | 3 | if ($request->created_after) { |
|
30 | 1 | $modelLogs->where('created_at', '>', Carbon::parse($request->created_after)); |
|
31 | } |
||
32 | 3 | if ($request->reverted_before) { |
|
33 | 1 | $modelLogs->where('reverted_at', '<', Carbon::parse($request->reverted_before)); |
|
34 | } |
||
35 | 3 | if ($request->reverted_after) { |
|
36 | 1 | $modelLogs->where('reverted_at', '>', Carbon::parse($request->reverted_after)); |
|
37 | } |
||
38 | 3 | if ($request->action) { |
|
39 | 1 | $modelLogs->where('action', $request->action); |
|
40 | } |
||
41 | |||
42 | 3 | return $modelLogs; |
|
43 | } |
||
44 | |||
45 | 1 | public function show(ModelLog $log, Request $request) |
|
59 | |||
60 | 4 | public function revert($id, Request $request) |
|
81 | } |
||
82 |
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: