diff --git a/app/Http/Controllers/SubCategoryController.php b/app/Http/Controllers/SubCategoryController.php index 42ac39c..6a9e9ba 100644 --- a/app/Http/Controllers/SubCategoryController.php +++ b/app/Http/Controllers/SubCategoryController.php @@ -43,17 +43,18 @@ public function store(StoreSubCategoryRequest $request): JsonResponse public function show($id): JsonResponse { $subCategory = SubCategory::find($id); - - return response()->json([ - 'status' => 'success', - 'data' => $subCategory, - ]); + if (!$subCategory) { + return response()->json([ + 'status' => 'No Data Found', + 'code' => '404', + ]); + } else { + return response()->json([ + 'status' => 'success', + 'data' => $subCategory, + ]); + } } - - - - - /** * Update the specified resource in storage. */