Closed hcivelek closed 2 years ago
I'd just put the defaults on the DTO class.
Alternatively, you could probably add a constructor something like this (untested):
class LibraryConf extends CastableDataTransferObject
{
// ...
public function __construct(array $arguments)
{
$arguments['minDeliveryDays'] ??= config('preferences.min_delivery_days');
parent::__construct($arguments);
}
}
Hope that helps!
Hi, I want to thank you first for this package. is it possible to specify some default values in the cast via the config file?
When I tried like:
I got:
Constant expression contains invalid operations
I understand that is not a Laravel or this package's problem, it is PHP's problem, but is there any way to get around it? Or writing some defaults on the class directly is not a big deal?