diff --git a/app/Controller/BaseController.php b/app/Controller/BaseController.php index 7fe234a..cb41ca1 100644 --- a/app/Controller/BaseController.php +++ b/app/Controller/BaseController.php @@ -21,6 +21,20 @@ abstract class BaseController return $this->service; } + protected function validated(array $rules): array + { + $request = $this->getRequest(); + + $validator = $this->validator->make( + $request->all(), + $rules, + $request->messages(), + $request->attributes() + ); + $validator->validate(); + return $validator->validated(); + } + protected function getRequest(): FormRequest { return $this->request;