laravelurlroutesviewcontroller

Laravel : i have this message "page not found" without any error


//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


Solution

  • 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: