缺少Teepluss \ Theme \ Theme :: Teepluss \ Theme \ {closure}()的参数1

时间:2014-11-09 20:34:17

标签: laravel package

我正在使用la-ravel Teepluss的主题管理器但是当我绑定任何东西时它会给出这个错误:

缺少Teepluss \ Theme \ Theme :: Teepluss \ Theme {closure}()

的参数1

这是错误的屏幕截图

http://i.imgur.com/elQ5qLY.png

只需添加此行$ this-> theme-> bind(' active',' home');到下面的代码给出错误

public function showWelcome()
    {
        $this->theme->layout('default');
        $this->theme->setTitle($this->config['SEO']['home']['title']);
        $this->theme->setMeta_desc($this->config['SEO']['home']['meta_description']);
        $this->theme->setMeta_keywords($this->config['SEO']['home']['meta_keywords']);

        $this->theme->bind('active', 'home');

        return $this->theme->scope('home.index')->render();
    }

我认为包主题绑定有一些问题

1 个答案:

答案 0 :(得分:0)

最后我发现了这个问题。这个包中有bug。在clouser中不应该有任何参数,代码应该是这样的:

public function bind($variable, $callback = null)
    {
        $name = 'bind.'.$variable;

        // If callback pass, so put in a queue.
        if ( ! empty($callback))
        {
            // Preparing callback in to queues.
            $this->events->listen($name, function() use ($callback, $variable)
            {
                return ($callback instanceof Closure) ? $callback() : $callback;
            });
        }

        // Passing variable to closure.
        $_events   =& $this->events;
        $_bindings =& $this->bindings;

        // Buffer processes to save request.
        return array_get($this->bindings, $name, function() use (&$_events, &$_bindings, $name)
        {
            $response = current($_events->fire($name));

            array_set($_bindings, $name, $response);

            return $response;
        });
    }