Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

morph relation laravel

You may register the morphMap in the boot function of your 
AppProvidersAppServiceProvider class or create a separate service provider 
if you wish.

use IlluminateDatabaseEloquentRelationsRelation;

Relation::morphMap([
    'post' => 'AppModelsPost',
    'video' => 'AppModelsVideo',
]);
 
PREVIOUS NEXT
Tagged: #morph #relation #laravel
ADD COMMENT
Topic
Name
8+5 =