I am using Laravel 11.
I would like to add a rule after the validation.
Today I have this situation :
public function rules(): array
{
return [
'group_id' => 'required|uuid|exists:groups,id',
'user_id' => [
'required', 'uuid',
Rule::exists('users', 'id')->where(function (Builder $query) {
return $query->whereIn('role_id', ['STUDENT', 'TEACHER', 'ADMIN']);
}),
],.......
I added an after method :
public function after(): array
{
return [
function (Validator $validator) {
.......
My wish is how to execute this after method only if all the previous rules passed ?