Fix Laravel Data/testsuite
This commit is contained in:
109
config/data.php
109
config/data.php
@@ -1,44 +1,73 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Contracts\Support\Arrayable;
|
||||
use App\DataTransferObjects\Support\Casts\CarbonCast;
|
||||
use Spatie\LaravelData\Transformers\ArrayableTransformer;
|
||||
use App\DataTransferObjects\Support\Transformers\CarbonTransformer;
|
||||
use App\DataTransferObjects;
|
||||
|
||||
return [
|
||||
/*
|
||||
* The package will use this date format when working with dates through the app
|
||||
*/
|
||||
'date_format' => DATE_ATOM,
|
||||
|
||||
/*
|
||||
* Global transformers will take complex types and transform them into simple
|
||||
* types.
|
||||
*/
|
||||
'transformers' => [
|
||||
DateTimeInterface::class => CarbonTransformer::class,
|
||||
Arrayable::class => ArrayableTransformer::class,
|
||||
// BackedEnum::class => Spatie\LaravelData\Transformers\EnumTransformer::class,
|
||||
],
|
||||
|
||||
/*
|
||||
* Global casts will cast values into complex types when creating a data
|
||||
* object from simple types.
|
||||
*/
|
||||
'casts' => [
|
||||
DateTimeInterface::class => CarbonCast::class,
|
||||
// BackedEnum::class => Spatie\LaravelData\Casts\EnumCast::class,
|
||||
],
|
||||
|
||||
/*
|
||||
* Rule inferrers can be configured here. They will automatically add
|
||||
* validation rules to properties of a data object based upon
|
||||
* the type of the property.
|
||||
*/
|
||||
'rule_inferrers' => [
|
||||
Spatie\LaravelData\RuleInferrers\BuiltInTypesRuleInferrer::class,
|
||||
Spatie\LaravelData\RuleInferrers\AttributesRuleInferrer::class,
|
||||
Spatie\LaravelData\RuleInferrers\NullableRuleInferrer::class,
|
||||
Spatie\LaravelData\RuleInferrers\RequiredRuleInferrer::class,
|
||||
],
|
||||
];
|
||||
/*
|
||||
* The package will use this format when working with dates. If this option
|
||||
* is an array, it will try to convert from the first format that works,
|
||||
* and will serialize dates using the first format from the array.
|
||||
*/
|
||||
'date_format' => DATE_ATOM,
|
||||
|
||||
/*
|
||||
* Global transformers will take complex types and transform them into simple
|
||||
* types.
|
||||
*/
|
||||
'transformers' => [
|
||||
DateTimeInterface::class => DataTransferObjects\Support\Transformers\CarbonTransformer::class,
|
||||
\Illuminate\Contracts\Support\Arrayable::class => \Spatie\LaravelData\Transformers\ArrayableTransformer::class,
|
||||
BackedEnum::class => Spatie\LaravelData\Transformers\EnumTransformer::class,
|
||||
],
|
||||
|
||||
/*
|
||||
* Global casts will cast values into complex types when creating a data
|
||||
* object from simple types.
|
||||
*/
|
||||
'casts' => [
|
||||
DateTimeInterface::class => DataTransferObjects\Support\Casts\CarbonCast::class,
|
||||
BackedEnum::class => Spatie\LaravelData\Casts\EnumCast::class,
|
||||
],
|
||||
|
||||
/*
|
||||
* Rule inferrers can be configured here. They will automatically add
|
||||
* validation rules to properties of a data object based upon
|
||||
* the type of the property.
|
||||
*/
|
||||
'rule_inferrers' => [
|
||||
Spatie\LaravelData\RuleInferrers\SometimesRuleInferrer::class,
|
||||
Spatie\LaravelData\RuleInferrers\NullableRuleInferrer::class,
|
||||
Spatie\LaravelData\RuleInferrers\RequiredRuleInferrer::class,
|
||||
Spatie\LaravelData\RuleInferrers\BuiltInTypesRuleInferrer::class,
|
||||
Spatie\LaravelData\RuleInferrers\AttributesRuleInferrer::class,
|
||||
],
|
||||
|
||||
/**
|
||||
* Normalizers return an array representation of the payload, or null if
|
||||
* it cannot normalize the payload. The normalizers below are used for
|
||||
* every data object, unless overridden in a specific data object class.
|
||||
*/
|
||||
'normalizers' => [
|
||||
Spatie\LaravelData\Normalizers\ModelNormalizer::class,
|
||||
// Spatie\LaravelData\Normalizers\FormRequestNormalizer::class,
|
||||
Spatie\LaravelData\Normalizers\ArrayableNormalizer::class,
|
||||
Spatie\LaravelData\Normalizers\ObjectNormalizer::class,
|
||||
Spatie\LaravelData\Normalizers\ArrayNormalizer::class,
|
||||
Spatie\LaravelData\Normalizers\JsonNormalizer::class,
|
||||
],
|
||||
|
||||
/*
|
||||
* Data objects can be wrapped into a key like 'data' when used as a resource,
|
||||
* this key can be set globally here for all data objects. You can pass in
|
||||
* `null` if you want to disable wrapping.
|
||||
*/
|
||||
'wrap' => null,
|
||||
|
||||
/**
|
||||
* Adds a specific caster to the Symphony VarDumper component which hides
|
||||
* some properties from data objects and collections when being dumped
|
||||
* by `dump` or `dd`. Can be 'enabled', 'disabled' or 'development'
|
||||
* which will only enable the caster locally.
|
||||
*/
|
||||
'var_dumper_caster_mode' => 'development',
|
||||
];
|
||||
Reference in New Issue
Block a user