Answers for "laravel morph through"

PHP
0

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',
]);
Posted by: Guest on January-06-2021
0

laavel relation through morph

// Topic Model

public function users()
{
    return $this->hasManyThrough('AppUser', 'AppSubscriber', 'subscribable_id')->where('subscribable_type', array_search(static::class, Relation::morphMap()) ?: static::class);
}
Posted by: Guest on June-02-2020

Code answers related to "laravel morph through"

Browse Popular Code Answers by Language