jeudi 3 septembre 2015

Laravel 5 route returns view but changes url

Im not even sure if this is possible but what I am trying to do is this. I store different page modules in a database. When someone goes to a page with one of these modules, the pageController recognizes its a module and ( using the redirect path stored with this module in the DB ) redirects them to a get route which is how I know what info to pull and put on the page.

For instance, if someone was to go to /photo-album the pageController would recognize that was a page module and returns the redirect ( redirect/photo/albums ) and then redirects them to that route.

Route::get('redirect/photo/albums', ['uses' =>'PageController@getPhotoAlbums']);

The problem is the url then becomes /redirect/photo/albums. I would like it to maintain /photo-album

The reason I am doing it this way is because there will be several modules stored and each one will contain different things ( think blog, photo albums, video gallery etc. ). I need the redirect to figure out what goes on that page and what view to show. In this case PageController@getPhotoAlbums goes to the getPhotoAlbums method, pulls the photos and serves up the photoalbums view.

There may be a better way to do this and i'm open to it. Thanks in advance.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1UvN52d
via IFTTT

Aucun commentaire:

Enregistrer un commentaire