Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Custom Validation Messages & Fixes abort in success and warn #5

Merged
merged 2 commits into from
May 5, 2022

Conversation

tcampbPPU
Copy link
Member

@tcampbPPU tcampbPPU commented May 5, 2022

By default is will use the Laravel validator messages, but now if you pass a 3rd argument like below

$this
    ->option('range_1', 'required|int|between:1,5', ['between' => 'Your first range must be between :min and :max.'])
    ->option('range_2', 'required|int|between:6,10', ['between' => 'Your second range must be between :min and :max.'])
    ->verify();

it will use your custom message.

Also fixes issue when using success and warn from hitting exception

// works
return $this->success(message: 'User was deleted', data: ['user' => $request->user()]);
// doesnt work
  try {
      return $this->success(message: 'User was deleted', data: ['user' => $request->user()]);
  } catch (\Throwable $th) {
      // hits here
  }

@acidjazz acidjazz merged commit 5f9810a into fumeapp:master May 5, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants