json([ 'data' => $response ]); } /** * Store a newly created resource in storage * @param StorePermission $request * @return Response */ public function store(StorePermission $request) { $validated = $request->validated(); $response = Permission::create($validated); return response()->json([ 'data' => $response ]); } /** * Show the specified resource * @param int $id * @return Response */ public function show($id) { $response = Permission::findOrFail($id); return response()->json([ 'data' => $response ]); } /** * Update the specified resource in storage * @param UpdatePermission $request * @return Response */ public function update(UpdatePermission $request, $id) { $validated = $request->validated(); $permission = Permission::findOrFail($id); $permission->update($validated); return response()->json([ 'data' => $permission ]); } /** * Remove the specified resource from storage * @param int $id * @return Response */ public function destroy($id) { $permission = Permission::findOrFail($id); $permission->delete(); return response()->json([ 'message' => 'The data has been deleted' ]); } }