Laravel模型 - 投射时间

Is there a way to automatically cast a model's attribute whose type is time in the same way we do with date or datetime?

I know about mutators, but I wonder if it can be done in a cleaner way, like using $casts property.

As of Laravel 5.6, it is possible to use $casts to specify custom formats for dates & times. (relevant docs)

You'd want something like this:

protected $casts = [
    'created_at' => 'datetime:H:i',
];