Closed primapwd closed 6 years ago
Hi,
It was a bug in the default_controller
detection. The library was assuming that the /
URL of your Route::get('/', 'shop@index');
route is the root path, without considering the group prefix.
Thanks for report it.
EDIT: version 0.2.1 released.
Wow, thanks. And can I have route parameter inside group parameter like this?
Route::group('shop', function() {
Route::get('{slug}', 'shop@index'); // doesn't work
Route::get('/{slug}', 'shop@index'); // doesn't work too
});
When I tried, it throws exception
An uncaught Exception was encountered
Type: Luthier\Exception\RouteNotFoundException
Message: (null)
Filename: E:\xampp\htdocs\app\vendor\luthier\luthier\src\Route.php
Line Number: 649
Backtrace:
File: E:\xampp\htdocs\app\vendor\luthier\luthier\src\Functions.php
Line: 16
Function: getByName
File: E:\xampp\htdocs\app\application\controllers\Shop.php
Line: 43
Function: route
File: E:\xampp\htdocs\app\index.php
Line: 315
Function: require_once
Yes, you can.
But that seems an error with the route()
function,can you provide the code that is triggering that error?
Ah, my bad. Yes, you're right. It has nothing to do with route parameter. This is the code that triggering error.
$data['url'] = route('api.shop.products.list', ['name' => $name]);
The route()
function actually calling API Routes defined in api.php
Route::group('shop', function() {
Route::get('{name}/products/', 'shop@productList')->name('api.shop.products.list');
});
I'm glad of the problem got solved. +1
Closing.
Hi, I have these routes
I can visit
app.dev/shop/
properly. But whenever I visitapp.dev/
, it throws 404. I found thatproducts()
method doesn't exist onShop
controller and it breaksapp.dev/
route. So I createproducts()
onShop
controller.And now I have these new routes:
Visit
app.dev/
still works but visitingapp.dev/shop/products/data
not. It seems that your library only breaks when some of the same'/'
route on different group doesn't have actual method.