App\Traits\PermissionHasUsersTrait::boot PHP 메소드

boot() 공개 정적인 메소드

Boot the permission model Attach event listener to remove the many-to-many records when trying to delete Will NOT delete any records if the permission model uses soft deletes.
public static boot ( ) : void | boolean
리턴 void | boolean
    public static function boot()
    {
        parent::boot();
        static::deleting(function ($permission) {
            if (!method_exists(Config::get('entrust.permission'), 'bootSoftDeletingTrait')) {
                // Repeat role->sync code attached from EntrustPermissionTrait::boot() as this boot()
                // function overwrites it.
                $permission->roles()->sync([]);
                $permission->users()->sync([]);
            }
            return true;
        });
    }