Fields
By default, data gets stored as a scalar value in the array $data
field of the Record
.
You can wrap the scalar value in the Record
by defining the private $mapper
field on the record.
<?php
namespace Vendor\Domain\Record;
use Pckg\Database\Field\Datetime;
/**
* @property Datetime $registered_at
*/
class User
{
// ...
protected $mapper = [
'registered_at' => Datetime::class,
];
}
Or you can achieve the same thing by defining a property.
<?php
namespace Vendor\Domain\Record;
use Pckg\Database\Field\Datetime;
class User
{
// ...
protected ?Datetime $registered_at;
}
Datetime
JSON
Array
Object
Point
Raw
Last updated
Was this helpful?