doubeng3412 2017-04-23 14:11
浏览 51
已采纳

如何在Laravel中进行多页注册过程

I have a concept for how to make a multiple page registration route on my Laravel app, but there is still one area that I can't find. When the user begins to register, the registration route is called. Inside of the register route, multiple views are linked to each other on if statements. For instance, if the user completes one view for the registration, then return the view for the next part of the registration process. The user will continue navigating the routes within the registration process until completed. What I'm trying to find is how to notify the program that the user has completed a view through submitting their information to the app database. Is their a function that allows this to be notified?

Here is a pseudo code format of the route and possible a controller function:

Route posting of register, (possible controller function)
if user completes first section
    return next section view 
if user completes second section 
    return next section view 
if user completes third section 
    return next final view 
if user completes final section 
    redirect to different route
end 

end

If someone could answer this, I can type the functions and routes for this structure very quickly.

  • 写回答

1条回答 默认 最新

  • 啊啊啊小孔 2017-04-23 15:59
    关注

    You can use Session to store the values. Let me tell you how.

    Route: register/step/1 (use whatever you want)

    • User Enters The information.
    • Store it in Session using session()->put('key','value');.
    • Redirect to step 2.

    Route: register/step/2

    • User Enters the Information.
    • Store it in Session using session()->put('key','value');.
    • Redirect to step n.

    .
    .

    Route: register/step/n

    • User Enters the Information.
    • Store it in Session using session()->put('key','value');.
    • Redirect to step n+1.


    Now, At last, You can get data from Session using session()->get('key'); and process it and store it in Database or do whatever you want.

    According to me, it's the best way to make multi-page registration using Laravel.

    Let me know if this helps! Also let me know if you have any more questions.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?