Conditions | 1 |
Paths | 1 |
Total Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
9 | public function handle(ResourceRequest $request) |
||
10 | { |
||
11 | $resourceClass = $request->getResource(); |
||
12 | $resourceModel = $request |
||
13 | ->newResourceModel() |
||
14 | ->newQuery() |
||
15 | ->findOrFail($request->identifier()); |
||
16 | |||
17 | return response()->json(['data' => new $resourceClass($resourceModel)]); |
||
|
|||
18 | } |
||
19 | } |
||
20 |
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: