Jump to content

Laravel L55 return custom $errors to the view

Joveice

Hello,

 

How can I return custom errors the same way the validator returns them?

I want some custom ones that does not have anything to do with the validator but I don't want to add more error checkers in the form to display them.

 

I used to have validator errors and some basic return with('error', 'message'), but then I'd have to create multiple for each field in the form and have multiple checkers.

 

I'm unable to find how to do this as I'm not trying to add custom validation rules, only throw errors the same way so I can reuse the already working checkers.

Back-end developer, electronics "hacker"

Link to comment
Share on other sites

Link to post
Share on other sites

On 08/02/2018 at 9:05 PM, Joveice said:

Hello,

 

How can I return custom errors the same way the validator returns them?

I want some custom ones that does not have anything to do with the validator but I don't want to add more error checkers in the form to display them.

 

I used to have validator errors and some basic return with('error', 'message'), but then I'd have to create multiple for each field in the form and have multiple checkers.

 

I'm unable to find how to do this as I'm not trying to add custom validation rules, only throw errors the same way so I can reuse the already working checkers.

You can throw a validation exception... 

Business Management Student @ University St. Gallen (Switzerland)

HomeServer: i7 4930k - GTX 1070ti - ASUS Rampage IV Gene - 32Gb Ram

Laptop: MacBook Pro Retina 15" 2018

Operating Systems (Virtualised using VMware): Windows Pro 10, Cent OS 7

Occupation: Software Engineer

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, leodaniel said:

You can throw a validation exception... 

Not what I want. But I just noticed that creating custom rules has been reworked in L55 so I could use it after all.

Back-end developer, electronics "hacker"

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×