PHP

How to show error or success message in api.

  • Neel Bhardwaj

  • 07-Feb-2022

  • 0 comments

  • 104

For error :


return response()->json([
    'message' => 'Some error message.'
],404);

For success :


return response()->json([
    'message' => 'Some success message.'
],200);

"Programming isn't about what you know,
it's about what you can figure out.”
Chris Pine

Neel Bhardwaj

A full stack developer. I have a Passion for Creating Clean, Beautiful, Interactive, Minimalistic, Responsive and User Friendly website, Developed by Modular, Scalable and Functional Code.

Recent comments

Leave a reply