You have injected the Request via parameter $request. This is generally not recommended as there might be multiple instances during a request cycle (f.e. when using sub-requests). Instead, it is recommended to inject the RequestStack and retrieve the current request each time you need it via getCurrentRequest().
The method isValid() does not seem to exist on object<Illuminate\Contracts\Validation\Validator>.
This check looks for calls to methods that do not seem to exist on a given type.
It looks for the method on the type itself as well as in inherited classes or
implemented interfaces.
This is most likely a typographical error or the method has been renamed.
Loading history...
34
throw new RequestFailedValidation($validator->errors());
The method errors() does not seem to exist on object<Illuminate\Contracts\Validation\Validator>.
This check looks for calls to methods that do not seem to exist on a given type.
It looks for the method on the type itself as well as in inherited classes or
implemented interfaces.
This is most likely a typographical error or the method has been renamed.
Loading history...
35
}
36
}
37
38
public function json(): array
39
{
40
if (!isset($this->json)) {
41
$json = json_decode(
42
$this->request()->getContent(),
43
true, // associative array
44
512, // depth
45
JSON_UNESCAPED_SLASHES
46
);
47
48
if (JSON_ERROR_NONE !== json_last_error()) {
49
throw new JsonApiException(new MalformedRequest());
50
}
51
52
$this->json = $json;
53
}
54
55
return $this->json;
56
}
57
58
public function validator() : Validator
59
{
60
return $this->validator;
61
}
62
63
public function setValidator(Validator $validator)