How to use rules from Livewire? #274
Answered
by
francoism90
francoism90
asked this question in
Q&A
-
protected function rules(): array
{
return app(PostData::class)::rules();
} For some reason this causes Livewire to use the If I place it outside the Does the Data class contain something? I've tried using |
Beta Was this translation helpful? Give feedback.
Answered by
francoism90
Nov 29, 2022
Replies: 1 comment
-
https://spatie.be/docs/laravel-data/v2/as-a-data-transfer-object/request-to-data-object This is however really cool: protected function rules(): array
{
return Arr::prependKeysWith(
array: PostData::rules($this->post->toArray()),
prependWith: 'post.'
);
} This causes to have the rules have a payload. Nice! :) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
francoism90
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://spatie.be/docs/laravel-data/v2/as-a-data-transfer-object/request-to-data-object
This is however really cool:
This causes to have the rules have a payload.
Nice! :)