我正在尝试显示一个产品页面,其中包含与特定资产类型匹配的资产列表。例如,对于产品"Acme“,有两个资产:营养-facts.pdf(文档类型)和市场营销-Video o.mp4(视频类型)。在产品页面上,我想显示与“视频”资产类型匹配的第一个资产(如果存在的话)。产品模型包括一个DB列asset_id。{ * The assets that belong to the product. public function assets()
使用Laravel文档中的多到多多态relaltionshiop数据库结构,如下所示: id - integer id - integertaggables taggable_id - integer我想检索post记录,post.name LIKE %laravel%还是tags.name LIKE %laravel%。这对我来说是一个很大的挑战,因为我只想得到他们的名字由单词<