public function defineAllPermissions()
    {
        foreach ($this->getPermissions() as $permission) {

            Gate::define(
                $permission->name,
                function ($user, ...$arguments) use ($permission) {
                    foreach ($permission->roles as $role) {
                        if ($role->belongsToUser($user)) {
                            if (!empty($permission->class)
                                AND !empty($permission->method)
                                AND class_exists($permission->class)
                            ) {
                                $container = resolve($permission->class);
                                if (method_exists($container, $permission->method)) {
                                    array_unshift($arguments, $user);
                                    return
                                        call_user_func_array(
                                            [$container, $permission->method],
                                            $arguments
                                        );
                                } else {
                                    return false;
                                }
                            }
                            return true;
                        }
                    }
                    return false;
                }
            );
        }
        return false;
    }