Casts

Sketch automatically sets up appropriate casts based on field types:

YAML Type
Cast Type

enum

string

boolean

boolean

date

date

datetime

datetime

json

json

decimal

decimal:2

Example:

protected $casts = [
    'is_active' => 'boolean',
    'metadata' => 'array',
    'published_at' => 'datetime'
];

Last updated