Illuminate\Database\Eloquent\Model::morphedByMany PHP Method

morphedByMany() public method

Define a polymorphic, inverse many-to-many relationship.
public morphedByMany ( string $related, string $name, string $table = null, string $foreignKey = null, string $otherKey = null ) : Illuminate\Database\Eloquent\Relations\MorphToMany
$related string
$name string
$table string
$foreignKey string
$otherKey string
return Illuminate\Database\Eloquent\Relations\MorphToMany
    public function morphedByMany($related, $name, $table = null, $foreignKey = null, $otherKey = null)
    {
        $foreignKey = $foreignKey ?: $this->getForeignKey();
        // For the inverse of the polymorphic many-to-many relations, we will change
        // the way we determine the foreign and other keys, as it is the opposite
        // of the morph-to-many method since we're figuring out these inverses.
        $otherKey = $otherKey ?: $name . '_id';
        return $this->morphToMany($related, $name, $table, $foreignKey, $otherKey, true);
    }
Model