У меня было это решение хорошо работало в Laravel 5.3 < /p>
$procedure = Procedure::findOrFail($id);
$attached_stages = $procedure->stages()->getRelatedIds()->toArray();
< /code>
В моей процедуре < /code> Модель: < /p>
public function stages()
{
return $this->belongsToMany('App\Models\Stage', 'procedure_stage', 'procedure_id', 'stage_id')->withPivot('id','status')->withTimestamps();
}
< /code>
Теперь, после перехода на Laravel 5.4, я получаю эту ошибку: < /p>
Call to undefined method Illuminate\Database\Query\Builder::getRelatedIds()
< /code>
кажется, что getRelatedids < /code> был удален.>
Подробнее здесь: https://stackoverflow.com/questions/420 ... aravel-5-4