lundi 4 juillet 2016

How to return to an intended Part of a page

I have the typical scenario of an online newspaper where you have the article and below a form to comment, but where you need to login to comment. So on clicking it takes you to the log page and it should return you to that page once you have authenticated.

So, because the form is part of a page that the user can see without being logged in, I cannot write the middleware for that page created by a PostController, (get route).

The CommentController only has one method, which is the store one for the Form. so, of course, if I placed a middleware for that controller, it would fail because although it would indeed take you to the login page on clicking the submit button, the Intended URL saved would be that Post for the form, so on returning after authenticating, it would take you to a non existent URL page under the name of the Post route for that Form.

I have read about Auth::guards and the like but could not come clear with it,



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire