Я пытаюсь отсоединить поле от сводной таблицы, но получаю сообщение об ошибке «вызов функции-члена в строке». Я использую последнюю версию Laravel.
public function removeProfile($child) { $profile = Profile::find(1); $child->profiles()->detach($profile); return 'Success'; }
Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR) Вызов профиля функции-члена () в строке
в вашей модели что-то плитка это
return $this->belongsToMany('profie')->withPivot('user', 'profile');
, а в вашем контроллере должно быть
$variable->profile()->where(some condition)->first()->pivot->your_entity