I Create Restapi for my Joomla Site using lumen. I got Following Error in Lumen Route File.

lumen.ERROR: ReflectionException: Class App\Http\Controllers\App\Http\Controllers\CategoriesController does not exist in /var/www/j2mobapp/plugins/system/j2mobrest/api/vendor/illuminate/container/Container.php:749

My Route File Code :

$app->group(['prefix' => 'api/v2','namespace' => 'App\Http\Controllers'], function($app)
{

$app->get('appbanners/{id}', 'CategoriesController@getBannerImag'); 

});
1

There are 1 best solutions below

3
nakov On

What about deleting this from the group:

'namespace' => 'App\Http\Controllers'

As it is a default. That's why you see it doubled.

So unless you put them in a custom folder in your Controller folder, for example Admin then you will need to add 'namespace' => 'Admin' so each controller in the group will be prefixed as App\Http\Controllers\Admin

Also make sure that in your CategoriesController you have the namespace correct at the top of the class which is:

namespace App\Http\Controllers;