voyager: can't save when Bread model has a multi select with relationship
- Laravel Version: 5.4.*
- Voyager Version: 0.11.7
- PHP Version: 7.0.13
- Database Driver & Version:
Description:
I can’t save custom Bread form when it has a multi select with relationship . laravel thown the error:
BadMethodCallException in Builder.php line 2450: Call to undefined method Illuminate\Database\Query\Builder::tags_id()
Steps To Reproduce:
model news
class News extends Model
{
public $timestamps = false;
public function tagsId(){
return $this->belongsToMany(Tag::class);
}
}
model tag
class Tag extends Model { public $timestamps = false; }
news Bread
tags BREAD
table:news_tag
then i add/edit news ,I got the error

About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 18 (12 by maintainers)
Got it “working”, but it’s not the perfect solution. If you like to try it: In the voyager\src\Http\Controllers\Traits\BreadRelationshipParser.php line 103 Replace
for
And in the browse.blade.php line 42 replace the “multiple block” for
In my case I’m not using the link to the item. If you want to use it just replace the
<span>forNot the perfect soultion but it may help