mardi 19 juillet 2016

How to handle native exception in Laravel?

For example, I use:

return User::findOrFail($id);

When row does not exist with $id I get exception.

How I can return this exception in Json response? It returns HTML Laravel page now.

I need something like as:

{"error", "No query results for model"}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire