Support the ongoing development of Laravel.io →
posted 11 years ago
Requests

I've got a resource route that I need to get to, but for some reason, when I POST to the route, my catch-all route is being triggered.

Here is my setup:

Routes.php

Route::group(array('prefix' => 'admin'), function() {
    //THIS WORKS FINE
    //Route::any('/facilities/{id}', 'FacilitiesController@update'); 

    // I NEED THIS TO "CATCH" THE /facilities/{id} ROUTE
    Route::resource('facilities', 'FacilitiesController'); 
 
});

App::before(function($request) {

    Route::any( '/ADMIN/{path?}', function()
    {
        require '/ADMIN/index.php';

    })->where('path', '.+');

});

In the code above, if I am using the "resource" method to define my routes, a POST to /facilities/{id} hits my catch-all at the bottom.

However, if I use the "any" method to define my route, I can POST to the route without issue.

Any ideas? I have a ton of routes to define and I would like to be able to define them as resources.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

SKEEZERx skeezerx Joined 7 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.