0

//my route

Route::get('catalogue/{categorie?}','App\Http\Controllers\CatalogueController@index')->name('catalogue');

//my controller

namespace App\Http\Controllers;
use Illuminate\Http\Request;
class CatalogueController extends Controller
{
    function index($categorie = null )
    {
        return view('catalogue.index');
    }
}

and a view and i really dont understand why i cant have my catalogue url if need here a capture of my folders too enter image description here

I am trying to display the catalog of my products. So i created a route, a controller and a view,a simple thing, my code above. Then i go to my URL and type http://100.0.0.0:8000/catalogue and i have a message "not found" Thank you

1
  • no same message, and i just ran php artisan cache:clear and php artisan config:clear without result
    – user23719376
    Commented Jul 3 at 10:36

1 Answer 1

0

Check that the route is correctly configured:

php artisan route:list | grep catalogue

The output should contain:

  GET|HEAD   catalogue/{categorie?} catalogue › CatalogueController@ind…

Case a: it's not there

In this case, try clearing the route cache, then list the routes again.

php artisan route:clear

Case b: the route is outputted, but you still get 404

In this case, check that you don't have:

  • another route that matches the same URL, that comes before and returns 404 for some reason
  • a global middleware that returns 404
1
  • If you cache the routes, you must remember to run php artisan route:cache everytime you change something. In your local environment, it's more convenient if you just run php artisan route:clear and you don't cache them again. In that case, any change you make will be immediately visible.
    – Luca Puddu
    Commented Jul 3 at 15:01