Ad

Laravel 5 Wildcard Files Including

- 1 answer

I have multiple *.html files I need to include in my new project, all these files are numbered - 1.html, 2.html and so on. Now I'd like to use wildcard routing like mysite/item/1 redirecting to view with content included from 1.html file.

How do I do this? I'm not really asking for the code itself, but rather for pointing me in the right direction. I bet the solution is incredibly easy yet I can not figure it out right now.

Ad

Answer

Route::get('mysite/item/{view_name}', function($id) {
    return view($view_name);
});

Just pass the name of the view as a parameter as you're doing in the example. Then pass that parameter to the view() function..

Ad
source: stackoverflow.com
Ad