Voyager: Undefined model relationships锛歮orphMany ...

Created on 21 Apr 2018  路  4Comments  路  Source: the-control-group/voyager

  • Laravel Version: 5.6.17
  • Voyager Version: 1.0.*
  • PHP Version:
  • Database Driver & Version:

Model relation

php hasManyThrough morphTo morphMany morphToMany morphedByMany

Each project will basically use the model relationship here.

Is there a support for the plan?

feature help wanted

Most helpful comment

We are open to pull requests

All 4 comments

We are open to pull requests

Morphing is a really difficult topic, as the possible Models are unpredictable.
But maybe someone finds a way.

I was able to modify the blade templates to accommodate the relationships in relationship-partial.blade.php/ relationship-new-modal.blade.php.

  <option value="morphTo" @if(isset($relationshipDetails->type) && $relationshipDetails->type == 'morphTo'){{ 'selected="selected"' }}@endif>Morph To</option>
                <option value="morphToMany" @if(isset($relationshipDetails->type) && $relationshipDetails->type == 'morphToMany'){{ 'selected="selected"' }}@endif>Morph To Many</option>

and the javascript to allow input of the pivot table and adding some additional input to accept a "morph_column" which would be used to morphToMany(\Model:class, *morph_column*)

<p class="morph_column"><strong>Morph Column <span class="label_table_name"></span>: </strong>
                                        <span><input type="text" class="form-control" name="morph_column" placeholder="Morph Column" value="{{ $relationshipDetails->morph_column ?? ''}}"></span>
                                                        </p>

the problem I am having is that it does not seem to "save" the morph_column in the JSON details

* Laravel Version: 5.6.17

* Voyager Version: 1.0.*

* PHP Version:

* Database Driver & Version:

Model relation

hasManyThrough
morphTo
morphMany
morphToMany
morphedByMany

Each project will basically use the model relationship here.

Is there a support for the plan?

Me Too waiting for morph relationships in voyager.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wp-src picture wp-src  路  3Comments

rayqiri picture rayqiri  路  3Comments

IvanBohonosiuk picture IvanBohonosiuk  路  4Comments

ferrywae picture ferrywae  路  4Comments

MikadoInfo picture MikadoInfo  路  3Comments