thedevdojo/voyager
View on GitHub[BUG] belongsToMany Relationship, Allow Tagging, and Custom URL Slugs
Open
#4128 opened on May 9, 2019
help wantedtype:bug
Description
Version information
- Laravel: v5.7.28
- Voyager: v1.2.3
- PHP: 7.2
- Database: MySQL 5.7.25
Description:
When a relationship has tagging enabled and the BREAD for the other table has a custom slug a route not defined error is thrown.
Steps To Reproduce
Steps to reproduce the behavior:
- Create belongsToMany relationships
- Create BREAD with custom "URL Slugs"
- Add relationship and Allow Tagging
- Go to the Add or Edit page of the BREAD with the relationship
Expected behavior
The add and edit page to load.
Additional context
vendor/tcg/voyager/resources/views/formfields/relationship.blade.php:159
When I looked at the relationship blade file the route is created off the table name when tagging is on. And the route for the relationship is a custom slug.
@if(isset($options->taggable) && $options->taggable == 'on')
data-route="{{ route('voyager.'.\Illuminate\Support\Str::slug($options->table).'.store') }}"
data-label="{{$options->label}}"
data-error-message="{{__('voyager::bread.error_tagging')}}"
@endif