diff --git a/app/Http/Controllers/Api/PermissionController.php b/app/Http/Controllers/Api/PermissionController.php index 70b169f..94d53a1 100644 --- a/app/Http/Controllers/Api/PermissionController.php +++ b/app/Http/Controllers/Api/PermissionController.php @@ -54,7 +54,7 @@ public function store(Request $request) if($permission->save()) { - return new PermissionResource($permission); + return PermissionResource::make($permission); } return response()->json(['status' => 403, 'hasError' => false, 'messages' => []], 403); @@ -68,7 +68,7 @@ public function store(Request $request) */ public function show($id) { - return new PermissionResource(Permission::find($id)); + return PermissionResource::make(Permission::find($id)); } /** @@ -106,7 +106,7 @@ public function update(Request $request, $id) if($permission->save()) { - return new PermissionResource($permission); + return PermissionResource::make($permission); } return response()->json(null, 500); diff --git a/app/Http/Controllers/Api/RoleController.php b/app/Http/Controllers/Api/RoleController.php index 98e715c..842981c 100644 --- a/app/Http/Controllers/Api/RoleController.php +++ b/app/Http/Controllers/Api/RoleController.php @@ -54,7 +54,7 @@ public function store(Request $request) if($role->save()) { - return new RoleResource($role); + return RoleResource::make($role); } return response()->json(['status' => 403, 'hasError' => false, 'messages' => []], 403); @@ -68,7 +68,7 @@ public function store(Request $request) */ public function show($id) { - return new RoleResource(Role::find($id)); + return RoleResource::make(Role::find($id)); } /** @@ -106,7 +106,7 @@ public function update(Request $request, $id) if($role->save()) { - return new RoleResource($role); + return RoleResource::make($role); } return response()->json(null, 500); diff --git a/app/Http/Controllers/Api/UserController.php b/app/Http/Controllers/Api/UserController.php index 0671801..494acd2 100644 --- a/app/Http/Controllers/Api/UserController.php +++ b/app/Http/Controllers/Api/UserController.php @@ -123,7 +123,7 @@ public function update(Request $request, $id) } } $user = User::find($id); - return new UserResource($user); + return UserResource::make($user)->hide(['meta']); } return response()->json(null, 500);