From c8c2efc11e1a3ca767aa6cace6e354ccb7d8b23a Mon Sep 17 00:00:00 2001 From: Oscar Cabrera Date: Tue, 11 Jun 2024 09:03:56 -0600 Subject: [PATCH] add config file --- config/json-api-format.php | 2 +- docs/usage/install.md | 55 ++++++++++++++++++++++++++++++++++++++ semver.json | 4 +-- 3 files changed, 58 insertions(+), 3 deletions(-) diff --git a/config/json-api-format.php b/config/json-api-format.php index e097d9b..94ec725 100644 --- a/config/json-api-format.php +++ b/config/json-api-format.php @@ -4,5 +4,5 @@ /* * The name of the macro that is added to the Eloquent query builder. */ - 'method_name' => 'applyFilters', + 'method_name' => 'getFields', ]; diff --git a/docs/usage/install.md b/docs/usage/install.md index 723f902..7afead5 100644 --- a/docs/usage/install.md +++ b/docs/usage/install.md @@ -14,3 +14,58 @@ composer require oscabrera/laravel-json-api-format-paginate This command instructs Composer to download the `oscabrera/laravel-json-api-format-paginate` package from the Packagist repository and include it in your project's dependencies. + +### Publish the Configuration File: + +The configuration file is optional, but provides additional flexibility by allowing you to change the name of the method +used to get the fields from the model. To publish the configuration file, run the following command: + +```shell +php artisan vendor:publish --provider="Oscabrera\JsonApiFormatPaginate\JsonApiFormatPaginateServiceProvider" --tag="config" +``` + +This command will create a `config/json-api-format.php` file in your Laravel application. You can edit this file to adjust +the package settings. + +### Configuration File Example + +The published configuration file `config/json-api-format.php` will have the following content by default: + +```php +return [ + /* + * The name of the macro that is added to the Eloquent query builder. + */ + 'method_name' => 'getFields', +]; +``` + +### Purpose of Configuration File + +The configuration file allows you to change the name of the method that is used to get the fields from the model. By +default, the method is called `getFields`, however, you can change this name depending on your +preferences or project needs. + +## Others Configuration Files + +### Json Api Paginate Configuration File + +if you want to change the configurations of the pagination, you can edit the `config/json-api-paginate.php` file. + +```shell +php artisan vendor:publish --provider="Spatie\JsonApiPaginate\JsonApiPaginateServiceProvider" --tag="config" +``` + +This command will create a `config/json-api-paginate.php` file in your Laravel application. You can edit this file to +adjust the package settings. + +### Query Builder Configuration File + +if you want to change the configurations of the query builder, you can edit the `config/query-builder.php` file. + +```shell +php artisan vendor:publish --provider="Spatie\QueryBuilder\QueryBuilderServiceProvider" --tag="query-builder-config" +``` + +This command will create a `config/query-builder.php` file in your Laravel application. You can edit this file to adjust +the package settings. \ No newline at end of file diff --git a/semver.json b/semver.json index 66c99d3..28cf825 100644 --- a/semver.json +++ b/semver.json @@ -1,4 +1,4 @@ { - "version": "v1.0.0", - "last-update-type": "major" + "version": "v1.0.1", + "last-update-type": "patch" }