I have to create ,,log in to comment" button. On click this button should redirect user to login page and after successfull loging in, he should be redirected to page, where he have clicked that button. I tried to make fake url with auth middleware around it like this:
Route::group(['middleware' => 'auth'], function() {
Route::get('/log-in-to-comment', 'UserController@getLogInToComment');
});
I have defined my getLogInToComment
function like this:
public function getLogInToComment() {
return redirect()->back();
}
But it redirects me to /log-in-to-comment
which is already in filter so I get too many redirects. Also I have tried return Redirect::to(URL::previous());
but it also doesn't work. As far as I know, post method should not be used on redirects, so how do I deal with this simple task? Thanks in advance!