Changing the path for posts to something else.
Created 8 years ago by william

I was just running into this, and even though it's extremely easy to fix and it's also in the documentation. I thought would post a tip about it since i am sure someone else will look for it.

Version 2.2 of anomaly/posts-module

(If you are running 2.1 as i were. Then just update your composer file and run composer update. No migration needed )

Publish the posts files

php artisan addon:publish posts

The create a routes.php file located in :

domain.dev/resources/APPLICATION_NAME/routes.php

Simply paste the following inside

<?php

Route::get('yournewpath', [
    'as'   => 'anomaly.module.posts::posts.index',
    'uses' => 'Anomaly\PostsModule\Http\Controller\PostsController@index',
]);

Version 2.1 anomaly/posts-module

You simply publish the addon files with the following command:

php artisan addon:publish posts

Then you edit your path in the configuration file, located here:

DOMAIN.DEV/resources/YOURAPPNAME/addons/anomaly/posts-module/config/paths.php

Change

'module' => 'posts', // Change posts to news as an example.

Everything is well documented here: https://www.pyrocms.com/documentation/streams-platform/v1.1#services/config/overriding-configuration-files

ryanthompson  —  8 years ago

If you opt into v2.2 for posts (will come standard in Pyro v3.2) you can simply create a routes.php here:

resources/REF/routes.php

And override the route by name:

Route::get('news', [
    'as'   => 'anomaly.module.posts::posts.index',
    'uses' => 'Anomaly\PostsModule\Http\Controller\PostsController@index',
]);
william  —  7 years ago

Would you then do

Route::get("posts",function(){
        abort(404);
    });

to make sure you disable the old posts routes?