php - 访问 morphedByMany 关系
问题描述
你知道如何访问 morphedByMany 关系吗?
我得到了这个 api 路由,当我访问这个路径时,我将看到所有附加了特定 TAG 的文章:
Route::get('/tags/{tag:slug}', 'Tags\TagController@index');
标签型号:
public function articles()
{
return $this–>morphedByMany(Article::class, 'taggable' );
}
控制器:
return $tag->load(['articles']);
我收到此错误:调用未定义函数 App\morphedByMany()
解决方案
推荐阅读
- android - 如何在 paging3 库的 PagingDataAdapter 中添加单个项目
- nginx - Nginx 上游路径
- java - Java 流 - 映射
> 到地图 - r - 在特定功能上使用滞后
- python - ldap3 搜索具有最少成员数的广告组
- reactjs - 被破坏对象上的打字稿接口
- python - pytesseract 不一致的结果 [Python/pytesseract]
- reactjs - 带有 REACT.js 的 ASP.NET CORE npm 运行构建代码 1
- google-apps-script - MailApp.sendEmail 方法签名异常:参数(类)不匹配
- vba - 如何将数据插入到触发存储过程的表中以将文件导出到数据库服务器端的文件夹