]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/Api/ApiController.php
Extend /users API endpoint
[bookstack] / app / Http / Controllers / Api / ApiController.php
index b3f1fb7478ba3f040ac3ea99a9de3564ffb765ff..5eb8b1e3d286f0f82ce23b41362b1dbd557f7507 100644 (file)
@@ -5,16 +5,27 @@ use BookStack\Http\Controllers\Controller;
 use Illuminate\Database\Eloquent\Builder;
 use Illuminate\Http\JsonResponse;
 
-class ApiController extends Controller
+abstract class ApiController extends Controller
 {
 
+    protected $rules = [];
+    protected $printHidden = [];
+
     /**
      * Provide a paginated listing JSON response in a standard format
      * taking into account any pagination parameters passed by the user.
      */
-    protected function apiListingResponse(Builder $query, array $fields): JsonResponse
+    protected function apiListingResponse(Builder $query, array $fields, array $protectedFieldsToPrint = []): JsonResponse
     {
-        $listing = new ListingResponseBuilder($query, request(), $fields);
+        $listing = new ListingResponseBuilder($query, request(), $fields, $protectedFieldsToPrint);
         return $listing->toResponse();
     }
-}
\ No newline at end of file
+
+    /**
+     * Get the validation rules for this controller.
+     */
+    public function getValdationRules(): array
+    {
+        return $this->rules;
+    }
+}