I have set the debug to true on .env file. Added the exceptions correctly but when i am passing invalid or not exist in my database its showing me 404 error but here I put the custom error handling value. Here is my code. (also I put "Use Expectation;" on top so no need of \Expectation)
public function show($id) { //only one author with id try { $event = Event::with('eventCategory')->findOrFail($id); return new EventsResource($event); //return one author } catch(Expectation $e) { report($e); return response()->json(['status'=> false, 'message'=>'invalid data'],200); } }