PHP code example of sebastiaanluca / laravel-auto-morph-map

1. Go to this page and download the library: Download sebastiaanluca/laravel-auto-morph-map library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sebastiaanluca / laravel-auto-morph-map example snippets


use Illuminate\Database\Eloquent\Relations\Relation;

Relation::morphMap([
    'posts' => \App\Post::class,
    'videos' => \App\Video::class,
]);

Relation::morphMap([
    'collection_item' => 'App\CollectionItem',
]);

Relation::morphMap([
    'collection_items' => 'App\CollectionItem',
]);

Relation::morphMap([
    'CollectionItem' => 'App\CollectionItem',
]);

Relation::morphMap([
    'collection_item' => 'App\CollectionItem',
]);

Relation::morphMap([
    'collection-item' => 'App\CollectionItem',
]);

Relation::morphMap([
    'collectionItem' => 'App\CollectionItem',
]);

Relation::morphMap([
    'CollectionItem' => 'App\CollectionItem',
]);

Relation::morphMap([
    'collection_item' => 'App\CollectionItem',
]);

php artisan morphmap:cache

php artisan morphmap:clear

php artisan vendor:publish