October CMS Plugin Routes.php not registering

- 1 answer

Ad

OctoberCMS Specific Problem,

When declaring routes in the {my}/{plugin}/Routes.php file they work on my local development environment which is a laravel Homestead Box. When I push it up to my production environment a Laravel-Forge provisioned (similar to homestead), it fails to register plugin routes.

There is the exact same code base on local & dev where I ran artisan route:list.

(LOCAL)[email protected]:~/default$ php artisan route:list
| Method   | URI                 | Action                                              |
|----------|---------------------|-----------------------------------------------------|
| GET|HEAD | chg/api/email/index | Chg\Email\Http\Controllers\[email protected] |
| POST     | chg/api/email/send  | Chg\Email\Http\Controllers\[email protected]  |
| GET|HEAD | index_eli           | Closure                                             |

(REMOTE)[email protected]:~/default$ php artisan route:list
| Method   | URI         |      | Action  |
|----------|-------------|------|---------|
| GET|HEAD | sitemap.xml |      | Closure |

Here are my plugins Routes.php file

<?php
Route::group(['prefix' => 'chg/api/email/'], function() {
    Route::get('index', 'Chg\Email\Http\Controllers\[email protected]');
    Route::post('send', 'Chg\Email\Http\Controllers\[email protected]');
});
Route::get('index_eli', function (){
    return 'hello';
});

I want to point out that if I were to register a route under modules/cms/routes.php it works both locally and remotely.

besides the generic 404 page not found error I am not getting any errors. So my question is has anyone seen this before? and do they know where to look to diagnose this?

Ad

Answer

Ad

Problem is mention in your first line {my}/{plugin}/Routes.php, R is capital it must be lower case for Linux system.

Its case sensitive issue, please change Routes.php to routes.php and it will work.

Linux treat Routes.php and routes.php as separate files and octoberCMS/Laravel look for routes.php not Routes.php

Ad
source: stackoverflow.com
Ad