Skip to content
Discussion options

You must be logged in to vote

I did a PR, please test it #1935

namespace Spatie\Permission\Traits;

use Illuminate\Database\Eloquent\Relations\BelongsToMany;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Spatie\Permission\PermissionRegistrar;

trait TeamHasRoles
{
    public static function bootTeamHasRoles()
    {
        static::deleting(function ($model) {
            $modelHasSoftDeleting = method_exists($model, 'isForceDeleting');
            $roleHasSoftDeleting = method_exists(app(PermissionRegistrar::class)->getRoleClass(), 'isForceDeleting');

            if ($modelHasSoftDeleting && ! $model->isForceDeleting()) {
                if ($roleHasSoftDeleting) {
                    $model->specific_roles(…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@mojowill
Comment options

@erikn69
Comment options

Comment options

You must be logged in to vote
1 reply
@erikn69
Comment options

Answer selected by mojowill
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants