@@ -11,8 +11,16 @@ A Lightweight [{JSON:API}](https://jsonapi.org/) Resource for Laravel.
1111composer require ark4ne/laravel-json-api
1212```
1313
14+ # Config
15+ | Path | Type | Description |
16+ | ------------------------------| --------------------------| -----------------------------------------------------------------------------------------|
17+ | ` describer.nullable ` | ` bool ` | For describer notation, defined if a value is nullable by default. |
18+ | ` describer.date ` | ` string ` datetime format | For describer notation, defined default date time format. |
19+ | ` describer.precision ` | ` int ` \ ` null ` | For describer notation, decimal precision for float value. ` null ` for disable rounding. |
20+ | ` relationship.when-included ` | ` bool ` | Allow to disabled by default the loading of relationship data. |
21+
1422# Usage
15- This package is an specialisation of Laravel's ` JsonResource ` class.
23+ This package is a specialisation of Laravel's ` JsonResource ` class.
1624All the underlying API's are still there, thus in your controller you can still interact
1725with ` JsonApiResource ` classes as you would with the base ` JsonResource ` class
1826
@@ -42,7 +50,7 @@ class UserFetchRequest extends FormRequest
4250}
4351```
4452
45- ` Rules\Includes ` will validate the include to exactly match the UserResource schema (determined by the relationships).
53+ ` Rules\Includes ` will validate the ` include ` to exactly match the UserResource schema (determined by the relationships).
4654
4755
4856### Fields validation
@@ -62,7 +70,7 @@ class UserFetchRequest extends FormRequest
6270}
6371```
6472
65- ` Rules\Fields ` will validate the fields to exactly match the UserResource schema (determined by the attributes and relationships).
73+ ` Rules\Fields ` will validate the ` fields ` to exactly match the UserResource schema (determined by the attributes and relationships).
6674
6775
6876### Customize validation message
@@ -381,13 +389,15 @@ UserResource::collection(User::all()); // => JsonApiCollection
381389## Described notation
382390
383391### Value methods
384- | Method | Description |
385- | -----------| --------------------------|
386- | ` bool ` | Cast to boolean |
387- | ` integer ` | Cast to integer |
388- | ` float ` | Cast to float |
389- | ` array ` | Cast to array |
390- | ` mixed ` | Don't cast, return as is |
392+ | Method | Description |
393+ | -----------| ------------------------------------------|
394+ | ` bool ` | Cast to boolean |
395+ | ` integer ` | Cast to integer |
396+ | ` float ` | Cast to float |
397+ | ` string ` | Cast to string |
398+ | ` date ` | Cast to date, allow to use custom format |
399+ | ` array ` | Cast to array |
400+ | ` mixed ` | Don't cast, return as is |
391401
392402### Relation methods
393403| Method | Description |
0 commit comments