Closed inmanturbo closed 3 years ago
This change allows the type column to be cast to an enum, and for that enum to be mapped to a child type, I.e:
class User { use \Parental\HasChildren; protected $childTypes = [ 'admin' => Admin::class, 'user' => User::class, ]; protected $casts = [ 'type' => UserTypeEnum::class, ]; } ... /** * @method static self admin() * @method static self user() */ class UserTypeEnum extends Enum { }
Or in php 8.1:
enum UserTypeEnum { case USER = 'user'; case ADMIN = 'admin'; }
This change allows the type column to be cast to an enum, and for that enum to be mapped to a child type, I.e:
Or in php 8.1: