]> BookStack Code Mirror - bookstack/blobdiff - app/Http/Controllers/Api/ApiController.php
Added examples, updated docs for image gallery api endpoints
[bookstack] / app / Http / Controllers / Api / ApiController.php
index 9652654be4d79a364d956149943cc266af7a6a18..5c448e49f4fbb66594eded24216c4eaa859b12b1 100644 (file)
@@ -32,10 +32,15 @@ abstract class ApiController extends Controller
      */
     public function getValidationRules(): array
     {
-        if (method_exists($this, 'rules')) {
-            return $this->rules();
-        }
+        return $this->rules();
+    }
 
+    /**
+     * Get the validation rules for the actions in this controller.
+     * Defaults to a $rules property but can be a rules() method.
+     */
+    protected function rules(): array
+    {
         return $this->rules;
     }
 }