Laravel-permission: Subclasses with global scope

Created on 3 Aug 2017  路  1Comment  路  Source: spatie/laravel-permission

Trying to achieve the same as stated in #41.

Unfortunately the former BelongsToMany now is a MorpToMany relation.
And as we try to get the roles from a subclass will try to find the wrong morphType.

Any advice how to get this to work?

Most helpful comment

So with some more googling I found:

public function getMorphClass()
{
    return User::class;
}

with which it works perfectly....

>All comments

So with some more googling I found:

public function getMorphClass()
{
    return User::class;
}

with which it works perfectly....

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bbdangar picture bbdangar  路  4Comments

enghelewa picture enghelewa  路  4Comments

MichalKrakow picture MichalKrakow  路  4Comments

tripex picture tripex  路  3Comments

wreighsantos picture wreighsantos  路  4Comments