|
1 | 1 | <?php
|
2 | 2 |
|
3 |
| -use Illuminate\Support\Enumerable; |
4 |
| - |
5 | 3 | return [
|
6 |
| - /** |
| 4 | + /* |
7 | 5 | * The package will use this format when working with dates. If this option
|
8 | 6 | * is an array, it will try to convert from the first format that works,
|
9 | 7 | * and will serialize dates using the first format from the array.
|
10 | 8 | */
|
11 | 9 | 'date_format' => DATE_ATOM,
|
12 | 10 |
|
13 |
| - /** |
| 11 | + /* |
14 | 12 | * When transforming or casting dates, the following timezone will be used to
|
15 | 13 | * convert the date to the correct timezone. If set to null no timezone will
|
16 | 14 | * be passed.
|
17 | 15 | */
|
18 | 16 | 'date_timezone' => null,
|
19 | 17 |
|
20 |
| - /** |
| 18 | + /* |
21 | 19 | * It is possible to enable certain features of the package, these would otherwise
|
22 | 20 | * be breaking changes, and thus they are disabled by default. In the next major
|
23 | 21 | * version of the package, these features will be enabled by default.
|
24 | 22 | */
|
25 | 23 | 'features' => [
|
26 | 24 | 'cast_and_transform_iterables' => false,
|
27 | 25 |
|
28 |
| - /** |
| 26 | + /* |
29 | 27 | * When trying to set a computed property value, the package will throw an exception.
|
30 | 28 | * You can disable this behaviour by setting this option to true, which will then just
|
31 | 29 | * ignore the value being passed into the computed property and recalculate it.
|
32 | 30 | */
|
33 | 31 | 'ignore_exception_when_trying_to_set_computed_property_value' => false,
|
34 | 32 | ],
|
35 | 33 |
|
36 |
| - /** |
| 34 | + /* |
37 | 35 | * Global transformers will take complex types and transform them into simple
|
38 | 36 | * types.
|
39 | 37 | */
|
|
43 | 41 | BackedEnum::class => Spatie\LaravelData\Transformers\EnumTransformer::class,
|
44 | 42 | ],
|
45 | 43 |
|
46 |
| - /** |
| 44 | + /* |
47 | 45 | * Global casts will cast values into complex types when creating a data
|
48 | 46 | * object from simple types.
|
49 | 47 | */
|
|
53 | 51 | // Enumerable::class => Spatie\LaravelData\Casts\EnumerableCast::class,
|
54 | 52 | ],
|
55 | 53 |
|
56 |
| - /** |
| 54 | + /* |
57 | 55 | * Rule inferrers can be configured here. They will automatically add
|
58 | 56 | * validation rules to properties of a data object based upon
|
59 | 57 | * the type of the property.
|
|
66 | 64 | Spatie\LaravelData\RuleInferrers\AttributesRuleInferrer::class,
|
67 | 65 | ],
|
68 | 66 |
|
69 |
| - /** |
| 67 | + /* |
70 | 68 | * Normalizers return an array representation of the payload, or null if
|
71 | 69 | * it cannot normalize the payload. The normalizers below are used for
|
72 | 70 | * every data object, unless overridden in a specific data object class.
|
|
80 | 78 | Spatie\LaravelData\Normalizers\JsonNormalizer::class,
|
81 | 79 | ],
|
82 | 80 |
|
83 |
| - /** |
| 81 | + /* |
84 | 82 | * Data objects can be wrapped into a key like 'data' when used as a resource,
|
85 | 83 | * this key can be set globally here for all data objects. You can pass in
|
86 | 84 | * `null` if you want to disable wrapping.
|
87 | 85 | */
|
88 | 86 | 'wrap' => null,
|
89 | 87 |
|
90 |
| - /** |
| 88 | + /* |
91 | 89 | * Adds a specific caster to the Symphony VarDumper component which hides
|
92 | 90 | * some properties from data objects and collections when being dumped
|
93 | 91 | * by `dump` or `dd`. Can be 'enabled', 'disabled' or 'development'
|
94 | 92 | * which will only enable the caster locally.
|
95 | 93 | */
|
96 | 94 | 'var_dumper_caster_mode' => 'development',
|
97 | 95 |
|
98 |
| - /** |
| 96 | + /* |
99 | 97 | * It is possible to skip the PHP reflection analysis of data objects
|
100 | 98 | * when running in production. This will speed up the package. You
|
101 | 99 | * can configure where data objects are stored and which cache
|
|
121 | 119 | ],
|
122 | 120 | ],
|
123 | 121 |
|
124 |
| - /** |
| 122 | + /* |
125 | 123 | * A data object can be validated when created using a factory or when calling the from
|
126 | 124 | * method. By default, only when a request is passed the data is being validated. This
|
127 | 125 | * behaviour can be changed to always validate or to completely disable validation.
|
128 | 126 | */
|
129 | 127 | 'validation_strategy' => \Spatie\LaravelData\Support\Creation\ValidationStrategy::OnlyRequests->value,
|
130 | 128 |
|
131 |
| - /** |
| 129 | + /* |
| 130 | + * A data object can map the names of its properties when transforming (output) or when |
| 131 | + * creating (input). By default, the package will not map any names. You can set a |
| 132 | + * global strategy here, or override it on a specific data object. |
| 133 | + */ |
| 134 | + 'name_mapping_strategy' => [ |
| 135 | + 'input' => null, |
| 136 | + 'output' => null, |
| 137 | + ], |
| 138 | + |
| 139 | + /* |
132 | 140 | * When using an invalid include, exclude, only or except partial, the package will
|
133 | 141 | * throw an exception. You can disable this behaviour by setting this option to true.
|
134 | 142 | */
|
135 | 143 | 'ignore_invalid_partials' => false,
|
136 | 144 |
|
137 |
| - /** |
| 145 | + /* |
138 | 146 | * When transforming a nested chain of data objects, the package can end up in an infinite
|
139 | 147 | * loop when including a recursive relationship. The max transformation depth can be
|
140 | 148 | * set as a safety measure to prevent this from happening. When set to null, the
|
141 | 149 | * package will not enforce a maximum depth.
|
142 | 150 | */
|
143 | 151 | 'max_transformation_depth' => null,
|
144 | 152 |
|
145 |
| - /** |
| 153 | + /* |
146 | 154 | * When the maximum transformation depth is reached, the package will throw an exception.
|
147 | 155 | * You can disable this behaviour by setting this option to true which will return an
|
148 | 156 | * empty array.
|
149 | 157 | */
|
150 | 158 | 'throw_when_max_transformation_depth_reached' => true,
|
151 | 159 |
|
152 |
| - /** |
153 |
| - * When using the `make:data` command, the package will use these settings to generate |
154 |
| - * the data classes. You can override these settings by passing options to the command. |
155 |
| - */ |
| 160 | + /* |
| 161 | + * When using the `make:data` command, the package will use these settings to generate |
| 162 | + * the data classes. You can override these settings by passing options to the command. |
| 163 | + */ |
156 | 164 | 'commands' => [
|
157 |
| - /** |
| 165 | + |
| 166 | + /* |
158 | 167 | * Provides default configuration for the `make:data` command. These settings can be overridden with options
|
159 | 168 | * passed directly to the `make:data` command for generating single Data classes, or if not set they will
|
160 | 169 | * automatically fall back to these defaults. See `php artisan make:data --help` for more information
|
161 | 170 | */
|
162 | 171 | 'make' => [
|
163 |
| - /** |
| 172 | + |
| 173 | + /* |
164 | 174 | * The default namespace for generated Data classes. This exists under the application's root namespace,
|
165 | 175 | * so the default 'Data` will end up as '\App\Data', and generated Data classes will be placed in the
|
166 | 176 | * app/Data/ folder. Data classes can live anywhere, but this is where `make:data` will put them.
|
167 | 177 | */
|
168 | 178 | 'namespace' => 'Data',
|
169 | 179 |
|
170 |
| - /** |
| 180 | + /* |
171 | 181 | * This suffix will be appended to all data classes generated by make:data, so that they are less likely
|
172 | 182 | * to conflict with other related classes, controllers or models with a similar name without resorting
|
173 | 183 | * to adding an alias for the Data object. Set to a blank string (not null) to disable.
|
|
176 | 186 | ],
|
177 | 187 | ],
|
178 | 188 |
|
179 |
| - /** |
| 189 | + /* |
180 | 190 | * When using Livewire, the package allows you to enable or disable the synths
|
181 | 191 | * these synths will automatically handle the data objects and their
|
182 | 192 | * properties when used in a Livewire component.
|
|
0 commit comments