用户登录并重定向后抛出MethodNotAllowedHttpException

用户登录并重定向后抛出MethodNotAllowedHttpException

问题描述:

正在测试,这就是行为:我有一个带有表单的页面,任何人都可以使用它(无需登录),提交时将您重定向到下一个需要登录的页面作为用户. 这是路线:

Was testing around and this is the behaviour: I have a page with a form, anyone can use it (no need to be logged in), when submitting you get redirected to the next one for which you need to be logged in as a user. Here is the route:

        /*
    | Request Booking (POST)
    */
    Route::post('/booking/request-pay-booking', array(
        'as' => 'booking-request-pay-booking-post',
        'uses' => 'BookingController@postRequestPayBooking'
    ));

只要您已经登录,一切都可以.如果您在单击提交时是公开的,它将重定向到登录屏幕,并且在您单击登录后,我尝试重定向到页面,但出现了MethodNotAllowedHttpException异常. 我一定在那里缺少什么...

Everything works as long as you are already logged in BEFORE. If you are public when you click submit it redirects to the log in screen and once you click log in I tries to redirect to the page but I get a MethodNotAllowedHttpException thrown at me. I must be missing something there...

您将如何处理?是因为它是一个POST,将我从一页转移到另一页,并且数据丢失了?

How would you handle that? Is it because it is a POST that takes me from one page to the other and the datas get lost?

谢谢!

谢谢.最终做了一件行之有效的事情:创建了一个新函数,在提交表单时我也重定向了它,在这个函数中,我验证数据并将输入存储在会话中.当VALIDATE通过时,我重定向到下一个视图,从该视图中我从会话中提取信息,并且即使我通过登录屏幕也可以正常工作. :)

Thanks. Ended up doing something that works: created a new function that I redirect too when submitting the form, in this one I validate datas and store in a session the inputs. When the VALIDATE passes I redirect to the next view in which I extract the infos from the session and now even if I go through login screen it works. :)