'string', ]; /** * The fillable properties. * * @var string[] */ protected $fillable = ['email']; /** * Overrides the models boot method. */ public static function boot() { parent::boot(); self::creating(function ($invite) { if (!$invite->code) { $invite->code = self::generateVerifyCode(); } }); } }