vanilophp/framework

Not working properly.

Closed this issue · 5 comments

Installed the application after following these two steps and run the app and get the error below.

https://vanilo.io/docs/3.x/installation

https://vanilo.io/docs/3.x/admin-installation

Route [vanilo.admin.product.index] not defined.

Did you add the Admin module to config/concord.php?

return [
    'modules' => [
        Vanilo\Foundation\Providers\ModuleServiceProvider::class,
        Konekt\AppShell\Providers\ModuleServiceProvider::class => [
            'ui' => [
                'name' => 'Shop Admin', // Your app's name to display on admin
                'url'  => '/admin/dashboard', // Base/Home URL after login (eg. dashboard)
                'routes' => [
                    'prefix' => 'admin',
                ],
            ],
        ],
        Vanilo\Admin\Providers\ModuleServiceProvider::class => [
            'routes' => [
                'prefix' => 'admin',
            ],  
        ],
    ],
    'register_route_models' => true
];

Use this instead:

return [
    'modules' => [
        Vanilo\Foundation\Providers\ModuleServiceProvider::class,
        Konekt\AppShell\Providers\ModuleServiceProvider::class => [
            'ui' => [
                'name' => 'Shop Admin', // Your app's name to display on admin
                'url'  => '/admin/dashboard', // Base/Home URL after login (eg. dashboard)
            ],
        ],
        Vanilo\Admin\Providers\ModuleServiceProvider::class,
    ],
    'register_route_models' => true
];

The reason is that the routes => [prefix => 'admin'] entries in the config are both redundant (the prefix is admin anyway), and erroneous since it doesn't include the route file definitions of appshell and admin.

When using custom route config, those values from the default module config need to be present as well.
This is due to how Laravel's Config::set() method works, it overwrites nested config arrays.

People keep making this same mistake because of the documentation here. Please where can we make PR for this.