How do you map multi morpmap with same index value?

  laravel

i have 2 tables ( media type and jobs )

tables

types (1 comic, 2 tv show, 3 movie )
jobs (1 artist, 2 actor )

it return nothing if i use duplicate index.

Relation::morphMap([
  1 => 'AppModelsComic',
  1 => 'AppModelsArtist',
  2 => 'AppModelsMovie'
]);

if i change Artist index to other and set table id to 3. it works. i set in AppServiceProvider within boot function

Source: Laravel

Leave a Reply