I have a PagesController
with one action: view
. This action accepts a page
argument.
What I want to achieve:
Have a routes example.com/about
and example.com/foobar
. When one of this routes is triggered, pass a value predefined in routes file to PagesController@view
.
In my routes file:
Route::get('about', function () {
return App::make('App\Http\Controllers\PagesController')->view('about');
})->name('aboutPage');
Route::get('foobar', function () {
return App::make('App\Http\Controllers\PagesController')->view('foobar');
})->name('foobarPage');
It works as expected, but I want to know is there a better and more proper way to achieve the same functionality?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2aeEVNE
via IFTTT
Aucun commentaire:
Enregistrer un commentaire