1 | <?php |
||
24 | abstract class JsonApiController extends Controller |
||
25 | { |
||
26 | use JsonApiErrors; |
||
27 | use QueriesResources; |
||
28 | use UpdatesModelRelations; |
||
29 | use AuthorizesRequests; |
||
30 | use ValidatesRequests; |
||
31 | |||
32 | /** |
||
33 | * The Eloquent Model for the resource. |
||
34 | * |
||
35 | * @var Model|string |
||
36 | */ |
||
37 | protected $model; |
||
38 | |||
39 | /** |
||
40 | * Create a new JsonApiController instance. |
||
41 | */ |
||
42 | public function __construct() |
||
53 | |||
54 | /** |
||
55 | * Return a listing of the resource. |
||
56 | * |
||
57 | * @param \Huntie\JsonApi\Http\Requests\JsonApiRequest $request |
||
58 | * @param \Illuminate\Database\Eloquent\Builder|null $query Custom resource query |
||
59 | * |
||
60 | * @return JsonApiResponse |
||
61 | */ |
||
62 | public function indexAction($request, $query = null) |
||
81 | |||
82 | /** |
||
83 | * Store a new record. |
||
84 | * |
||
85 | * @param \Huntie\JsonApi\Http\Requests\JsonApiRequest $request |
||
86 | * |
||
87 | * @return JsonApiResponse |
||
88 | */ |
||
89 | public function storeAction($request) |
||
99 | |||
100 | /** |
||
101 | * Return a specified record. |
||
102 | * |
||
103 | * @param \Huntie\JsonApi\Http\Requests\JsonApiRequest $request |
||
104 | * @param Model|mixed $record |
||
105 | * |
||
106 | * @return JsonApiResponse |
||
107 | */ |
||
108 | public function showAction($request, $record) |
||
115 | |||
116 | /** |
||
117 | * Update a specified record. |
||
118 | * |
||
119 | * @param \Huntie\JsonApi\Http\Requests\JsonApiRequest $request |
||
120 | * @param Model|mixed $record |
||
121 | * |
||
122 | * @return JsonApiResponse |
||
123 | */ |
||
124 | public function updateAction($request, $record) |
||
136 | |||
137 | /** |
||
138 | * Destroy a specified record. |
||
139 | * |
||
140 | * @param \Huntie\JsonApi\Http\Requests\JsonApiRequest $request |
||
141 | * @param Model|mixed $record |
||
142 | * |
||
143 | * @return JsonApiResponse |
||
144 | */ |
||
145 | public function destroyAction($request, $record) |
||
152 | |||
153 | /** |
||
154 | * Return a specified record relationship. |
||
155 | * |
||
156 | * @param \Huntie\JsonApi\Http\Requests\JsonApiRequest $request |
||
157 | * @param Model|mixed $record |
||
158 | * @param string $relation |
||
159 | * |
||
160 | * @return JsonApiResponse |
||
161 | */ |
||
162 | public function showRelationshipAction($request, $record, $relation) |
||
168 | |||
169 | /** |
||
170 | * Update a named relationship on a specified record. |
||
171 | * |
||
172 | * http://jsonapi.org/format/#crud-updating-relationships |
||
173 | * |
||
174 | * @param \Huntie\JsonApi\Http\Requests\JsonApiRequest $request |
||
175 | * @param Model|mixed $record |
||
176 | * @param string $relation |
||
177 | * |
||
178 | * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException |
||
179 | * |
||
180 | * @return JsonApiResponse |
||
181 | */ |
||
182 | public function updateRelationshipAction($request, $record, $relation) |
||
197 | |||
198 | /** |
||
199 | * Return existing instance of the resource or find by primary key. |
||
200 | * |
||
201 | * @param Model|mixed $record |
||
202 | * |
||
203 | * @throws ModelNotFoundException |
||
204 | * |
||
205 | * @return Model |
||
206 | */ |
||
207 | protected function findModelInstance($record) |
||
219 | |||
220 | /** |
||
221 | * Validate the requested included relationships against those that are |
||
222 | * allowed on the requested resource type. |
||
223 | * |
||
224 | * @param array $relations |
||
225 | * |
||
226 | * @throws InvalidRelationPathException |
||
227 | */ |
||
228 | protected function validateIncludableRelations(array $relations) |
||
236 | } |
||
237 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: