about api module.
Created 6 years ago by spotony
[2017-08-31 09:40:14] local.ERROR: Function name must be a string {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Function name must be a string at /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:150)
[stacktrace]
ryanthompson  —  6 years ago

Lol how did you get this? Steps to reproduce? What version of the API module is installed? (updated systems as of yesterday should show version numbers in the Addons module).

spotony  —  6 years ago

API module 1.1, I used pyro3.4 beta-1, using laravel passport component 4, docking API interface times wrong, need to remove

File: vendor/anomaly/stream-platform/src/Addon/AddonProvider.php:368 line

protected function registerApi(AddonServiceProvider $provider, Addon $addon)
    {
        if ($this->routesAreCached()) {
            return;
        }

        if (!$routes = $provider->getApi()) {
            return;
        }

        $this->router->group(
            [
                'middleware' => 'auth:api',// => 'middleware' => 'api'
            ],
            function (Router $router) use ($routes, $addon) {

                foreach ($routes as $uri => $route) {

                    /*
                     * If the route definition is an
                     * not an array then let's make it one.
                     * Array type routes give us more control
                     * and allow us to pass information in the
                     * request's route action array.
                     */
                    if (!is_array($route)) {
                        $route = [
                            'uses' => $route,
                        ];
                    }

                    $verb        = array_pull($route, 'verb', 'any');
                    $middleware  = array_pull($route, 'middleware', []);
                    $constraints = array_pull($route, 'constraints', []);

                    array_set($route, 'streams::addon', $addon->getNamespace());

                    if (is_string($route['uses']) && !str_contains($route['uses'], '@')) {
                        $router->resource($uri, $route['uses']);
                    } else {

                        $route = $router->{$verb}($uri, $route)->where($constraints);

                        if ($middleware) {
                            call_user_func_array([$route, 'middleware'], (array)$middleware);
                        }
                    }
                }
            }
        );

But auth doesn't work!