[core: versioning]: Route Not Found
Created 6 years ago by finnito

Hey all,

I have been following the instructions given here: https://pyrocms.com/help/addon-development/modules/implementing-versioning for implementing versioning with a custom addon.

I have removed the cruft but this is my addon service provider:

<?php namespace Finnito\RostersModule;

use Anomaly\Streams\Platform\Addon\AddonServiceProvider;

// Versioning
use Anomaly\PagesModule\Http\Controller\Admin\VersionsController;
use Anomaly\Streams\Platform\Assignment\VersionRouter;

class RostersModuleServiceProvider extends AddonServiceProvider
{

    /**
     * Map additional addon routes.
     *
     * @param Router $router
     */
    public function map(VersionRouter $versions)
    {
        // Register dynamic routes here for example.
        // Use method injection or commands to bring in services.
        $versions->route($this->addon, VersionsController::class);
    }

}

And in src/Http/Controller/Admin/VersionsController.php I've got:

<?php namespace Finnito\RostersModule\Http\Controller\Admin;

use Finnito\RostersModule\Roster\RosterModel;

class VersionsController extends \Anomaly\Streams\Platform\Http\Controller\VersionsController
{

   /**
     * The versionable model.
     *
     * @var string
     */
    protected $model = RosterModel::class;

}

The only bit of the guide that I'm confused about is this line:

VersionRouter::route(Addon $addon, $controller, $prefix = null, $base = '/versions');

Where am I supposed to put this? In my addon service provider? In the map method? It's a little unclear. Any help would be appreciated!

Cheers, Finn