Answer the question
In order to leave comments, you need to log in
How can I make PHP not display its own error, but only my written error?
I have created a form to add data to a table. 1 column is unique, that is, the primary key. When I add the same key that exists, I get this error
Illuminate \ Database \ QueryException (23000)
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'test' for key 'PRIMARY' (SQL: insert into `type` (`type`, `description`) values (test, asdfasf))
Answer the question
In order to leave comments, you need to log in
Throw your Exception
But in your case, as I understand it, the question is different, you just need to validate the data on a unique value, and since the decision about validation came to my mind, and not yours, I strongly recommend that you study the documentation
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question