08-06-2023, 04:25 PM
Namespace in group (or callback) don't work (Lumen, Laravel)? I want to remove the code from routes.php to controllers. And so!
use App\Http\Controllers;
// OK!
$app->get('path', 'BarController@getId');
$app->group(['prefix' => 'foo'], function ($app) {
// OK!
$app->get('path', '\App\Http\Controllers\BarController@getId');
// Class BarController does not exist
$app->get('path', 'BarController@getId');
});
use App\Http\Controllers;
// OK!
$app->get('path', 'BarController@getId');
$app->group(['prefix' => 'foo'], function ($app) {
// OK!
$app->get('path', '\App\Http\Controllers\BarController@getId');
// Class BarController does not exist
$app->get('path', 'BarController@getId');
});