@@ -111,9 +111,11 @@ class Validators extends AbstractValidators
111111 *
112112 * @param mixed|null $record
113113 * the record being updated, or null if creating a resource.
114+ * @param array $data
115+ * the data being validated.
114116 * @return mixed
115117 */
116- protected function rules($record = null ): array
118+ protected function rules($record, array $data ): array
117119 {
118120 return [
119121 //
@@ -218,7 +220,7 @@ class Validators extends AbstractValidators
218220{
219221 // ...
220222
221- protected function rules($record = null ): array
223+ protected function rules($record, array $data ): array
222224 {
223225 return [
224226 'title' => 'required|string|min:1|max:255',
@@ -239,7 +241,7 @@ This is because the package complies with the JSON API spec and validates all re
239241check that they exist. Therefore the following ** does not** need to be used:
240242
241243``` php
242- protected function rules($record = null ): array
244+ protected function rules($record, array $data ): array
243245{
244246 return [
245247 'author.id' => 'exists:users,id',
@@ -253,7 +255,7 @@ type is provided to the constructor, then the plural form of the attribute name
253255example:
254256
255257``` php
256- protected function rules($record = null ): array
258+ protected function rules($record, array $data ): array
257259{
258260 return [
259261 'author' => [
@@ -386,7 +388,7 @@ class Validators extends AbstractValidators
386388{
387389 // ...
388390
389- protected function rules($record = null ): array
391+ protected function rules($record, array $data ): array
390392 {
391393 return [
392394 'title' => "required|string|min:3",
@@ -925,7 +927,7 @@ class Validators extends AbstractValidators
925927{
926928 // ...
927929
928- protected function rules($record = null ): array
930+ protected function rules($record, array $data ): array
929931 {
930932 return [
931933 'name' => 'required|string',
@@ -962,7 +964,7 @@ class Validators extends AbstractValidators
962964 return $validator;
963965 }
964966
965- protected function rules($record = null ): array
967+ protected function rules($record, array $data ): array
966968 {
967969 $rules = [
968970 'name' => 'required|string',
0 commit comments