-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: install spatie/laravel-json-api-paginate and support current…
…_sort
- Loading branch information
Showing
23 changed files
with
314 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
return [ | ||
|
||
/* | ||
* The maximum number of results that will be returned | ||
* when using the JSON API paginator. | ||
*/ | ||
'max_results' => 50, | ||
|
||
/* | ||
* The default number of results that will be returned | ||
* when using the JSON API paginator. | ||
*/ | ||
'default_size' => 20, | ||
|
||
/* | ||
* The key of the page[x] query string parameter for page number. | ||
*/ | ||
'number_parameter' => 'number', | ||
|
||
/* | ||
* The key of the page[x] query string parameter for page size. | ||
*/ | ||
'size_parameter' => 'size', | ||
|
||
/* | ||
* The key of the page[x] query string parameter for cursor. | ||
*/ | ||
'cursor_parameter' => 'cursor', | ||
|
||
/* | ||
* The name of the macro that is added to the Eloquent query builder. | ||
*/ | ||
'method_name' => 'jsonPaginate', | ||
|
||
/* | ||
* If you only need to display Next and Previous links, you may use | ||
* simple pagination to perform a more efficient query. | ||
*/ | ||
'use_simple_pagination' => false, | ||
|
||
/* | ||
* If you want to use cursor pagination, set this to true. | ||
* This would override use_simple_pagination. | ||
*/ | ||
'use_cursor_pagination' => false, | ||
|
||
/* | ||
* Here you can override the base url to be used in the link items. | ||
*/ | ||
'base_url' => null, | ||
|
||
/* | ||
* The name of the query parameter used for pagination | ||
*/ | ||
'pagination_parameter' => 'page', | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace Support\Metadata; | ||
|
||
use Illuminate\Database\Query\Builder; | ||
|
||
class GetQueryMetaDataAction | ||
{ | ||
public function __invoke(Builder $query): array | ||
{ | ||
return [ | ||
'current_sort' => $query->orders, | ||
]; | ||
} | ||
} |
Oops, something went wrong.