Module route "uses" throwing error on install

emergingdzns - 1 week ago

Did something change recently in the module service provider methodology? I am trying to install a new module on a new installation of Pyro and I'm getting this error:

ErrorException (E_NOTICE)
Undefined index: uses

In the pretty page output on the right it's highlighting the following lines of vendor/anomaly/streams-platform/src/Addon/AddonProvider.php (338&339):

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

Here's an example of my $routes variable in my new module:

    protected $routes = [
        'admin/horses/registrations'           => 'Evet\HorsesModule\Http\Controller\Admin\[email protected]',
        'admin/horses/registrations/edit/{id}' => 'Evet\HorsesModule\Http\Controller\Admin\[email protected]',
        'admin/horses/payments'           => 'Evet\HorsesModule\Http\Controller\Admin\[email protected]',
        'admin/horses/payments/edit/{id}' => 'Evet\HorsesModule\Http\Controller\Admin\[email protected]',
        'admin/horses'           => 'Evet\HorsesModule\Http\Controller\Admin\[email protected]',
        'admin/horses/create'    => 'Evet\HorsesModule\Http\Controller\Admin\[email protected]',
        'admin/horses/edit/{id}' => 'Evet\HorsesModule\Http\Controller\Admin\[email protected]',

        'horses'                => ['middleware' => 'auth',
                                    'uses' => 'Evet\HorsesModule\Http\Controller\[email protected]'],
        'horses/create'         => ['middleware' => 'auth',
                                    'Evet\HorsesModule\Http\Controller\[email protected]'],
        'horses/remove/{id}'    => ['middleware' => 'auth',
                                    'Evet\HorsesModule\Http\Controller\[email protected]'],

        'cart'                  => ['middleware' => 'auth',
                                    'Evet\HorsesModule\Http\Controller\[email protected]'],
        'cart/add/{horseId}'    => ['middleware' => 'auth',
                                    'Evet\HorsesModule\Http\Controller\[email protected]'],
        'cart/remove/{id}'      => ['middleware' => 'auth',
                                    'Evet\HorsesModule\Http\Controller\[email protected]'],
        'cart/update'           => ['middleware' => 'auth',
                                    'Evet\HorsesModule\Http\Controller\[email protected]'],

        'checkout'              => ['middleware' => 'auth',
                                    'Evet\HorsesModule\Http\Controller\[email protected]'],
        'checkout/receipt'      => ['middleware' => 'auth',
                                    'Evet\HorsesModule\Http\Controller\[email protected]'],
    ];

I've already syntax checked my code and it's fine. I've used this same ["uses" => '[email protected]', 'middleware' => 'auth'] scheme in previous modules with perfect success. Now the module is installed but breaking the entire site and artisan with it so I can even uninstall the module. What do I do now?

Answer

emergingdzns - 1 week ago

Nevermind. Somehow I only got 'uses' => before the first route. Ugh. That's what I get for coding tired.

emergingdzns - 1 week ago

Nevermind. Somehow I only got 'uses' => before the first route. Ugh. That's what I get for coding tired.

ryanthompson - 1 week ago

Ok we good here? Let me know if you run into anything that needs fixed I'll take care of it ^_^