Note that there are some explanatory texts on larger screens.

plurals
  1. POLaravel 3.x Route issue: page not found even with the route set
    text
    copied!<p>I got an annoying problem with a route, for a section of a CMS that I'm developing. I got routes for all the sections, "products", for example:</p> <pre><code> Route::get('admin/products', array('as' =&gt; 'admin/products', 'uses'=&gt; 'admin.products@index')); Route::get('admin/products/create', array('as' =&gt; 'admin/products/create', 'uses'=&gt; 'admin.products@create')); Route::get('admin/products/edit/(:num)', array('as' =&gt; 'admin/products/edit', 'uses'=&gt; 'admin.products@edit')); Route::get('admin/products/delete/(:num)', array('as' =&gt; 'admin/products/delete', 'uses'=&gt; 'admin.products@delete')); </code></pre> <p>.. and the related files, like the products controller, the product model and the views.</p> <p>Everything was doing well until I decided to create a new section, "users". I used the same approach as "products", creating the routes and the other files. In fact I just copied and paste the files, making the changes when needed -- pretty straightforward. By accessing "admin/users" and "admin/users/create", it works as expected. But I can't access "/users/edit/1" and "/users/delete/1". I thought it would be a route problem, but when I tested the route file, I got a 404 even before reaching the route. Here's an example:</p> <pre><code> Route::get('admin/users/edit/(:num)', function() { return "Holy Hell."; }); </code></pre> <p>"Holy Hell" is never printed into the screen.</p> <p>Here's the config for "users":</p> <pre><code> Route::get('admin/users', array('as' =&gt; 'admin/users', 'uses'=&gt; 'admin.users@index')); Route::get('admin/users/edit/(:num)', array('as' =&gt; 'admin/users/edit/', 'uses'=&gt; 'admin.users@edit')); Route::get('admin/users/create', array('as' =&gt; 'admin/users/create', 'uses'=&gt; 'admin.users@create')); Route::get('admin/users/delete/(:num)', array('as' =&gt; 'admin/users/delete', 'uses'=&gt; 'admin.users@delete')); </code></pre> <p><em><strong>Things that I noticed / Checked:</em></strong></p> <ul> <li>The index view, where is the users list, got a "URL::to_route('admin/users/edit')" function. I have no errors on the screen, so Laravel understands that the route 'admin/users/edit' is set correctly.</li> <li>I know that this is not a general problem, because the "edit" and "delete" methods for the other CMS sections have no issues.</li> <li>The views for these methods are there. So this is not a "file not found" issue.</li> </ul> <p>I wonder if I'm missing something really obvious here. Any ideas? If not, would anyone please tell me how to debug this?</p> <p>Thank you very much.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload