]> BookStack Code Mirror - bookstack/blob - app/Http/Controllers/Api/ApiController.php
Merge branch 'feature/public-login-redirect' of git://github.com/Xiphoseer/BookStack...
[bookstack] / app / Http / Controllers / Api / ApiController.php
1 <?php namespace BookStack\Http\Controllers\Api;
2
3 use BookStack\Api\ListingResponseBuilder;
4 use BookStack\Http\Controllers\Controller;
5 use Illuminate\Database\Eloquent\Builder;
6 use Illuminate\Http\JsonResponse;
7
8 class ApiController extends Controller
9 {
10
11     protected $rules = [];
12
13     /**
14      * Provide a paginated listing JSON response in a standard format
15      * taking into account any pagination parameters passed by the user.
16      */
17     protected function apiListingResponse(Builder $query, array $fields): JsonResponse
18     {
19         $listing = new ListingResponseBuilder($query, request(), $fields);
20         return $listing->toResponse();
21     }
22
23     /**
24      * Get the validation rules for this controller.
25      */
26     public function getValdationRules(): array
27     {
28         return $this->rules;
29     }
30 }