1

In API application I want to customize http errors (like 404, 500 or other http errors) I want to respond in this format

return response()->json(['message' => '', 'data' => null, 'result' => false],[specific error code]);

instead of showing laravel default error page enter image description here

how can I do that??

Alexandraf
  • 11
  • 1

2 Answers2

0

Create a file called 404.blade.php in this /resources/views/errors/ folder.
You can write whatever html you choose in this file to display to your users, and now when you get the 404 error this page will show to you
For other error pages
For example for 500 error page just create this file 500.blade.php, that it

azibom
  • 1,769
  • 1
  • 7
  • 21
-1

enter this command, and the views of errors will be available to edit, in the views file.

php artisan vendor:publish --tag=laravel-errors
Ahmed Ali
  • 123
  • 1
  • 9