【发布时间】:2019-11-04 18:56:42
【问题描述】:
我正在尝试从数据透视表中分离一个字段,但我一直收到错误“调用字符串上的成员函数”作为错误。我正在使用最新版本的 Laravel。
public function removeProfile($child)
{
$profile = Profile::find(1);
$child->profiles()->detach($profile);
return 'Success';
}
Symfony\Component\Debug\Exception\FatalThrowableError (E_ERROR) 在字符串上调用成员函数 profile()
【问题讨论】:
-
显然,当您调用函数 removeProfile() 时,您将传递一个字符串作为参数。你能添加调用函数的代码吗?
标签: string laravel function member