attempt([ 'email' => $request->email, 'password' => $request->password])) { $id = Category::where('name', $category)->first()->id; $services = Category::find($id)->services; if(is_null($services)){ return response()->json(["message " => "Record not found."], 404);} return response()->json($services, 200); } else{ return response()->json(["message " => "User auth failed."], 404); } } }