code = Str::random(8); }); } protected $casts = [ 'config' => 'json', 'type' => LinkType::class, 'price' => Amount::class.':4', 'cache' => 'json', ]; // 访问记录. public function visitLogs(): HasMany { return $this->hasMany(LinkVisitLog::class, 'link_id'); } }