简体   繁体   English

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

[英]How to make a multi page registration process in 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. 我有一个关于如何在Laravel应用程序上进行多页注册路线的概念,但是仍然找不到一个区域。 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. 在寄存器路由内部,多个视图在if语句上彼此链接。 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. 如果有人可以回答这个问题,我可以非常快速地为该结构键入函数和路由。

You can use Session to store the values. 您可以使用Session来存储值。 Let me tell you how. 让我告诉你如何。

Route: register/step/1 (use whatever you want) 路线:注册/第1步(使用您想要的任何方法)

  • User Enters The information. 用户输入信息。
  • Store it in Session using session()->put('key','value'); 使用session()->put('key','value');其存储在Session中session()->put('key','value'); .
  • Redirect to step 2. 重定向到步骤2。

Route: register/step/2 路线:注册/步骤/ 2

  • User Enters the Information. 用户输入信息。
  • Store it in Session using session()->put('key','value'); 使用session()->put('key','value');其存储在Session中session()->put('key','value'); .
  • Redirect to step n. 重定向到步骤n。

.
.

Route: register/step/n 路线:寄存器/步骤/ n

  • User Enters the Information. 用户输入信息。
  • Store it in Session using session()->put('key','value'); 使用session()->put('key','value');其存储在Session中session()->put('key','value'); .
  • Redirect to step n+1. 重定向到步骤n + 1。


Now, At last, You can get data from Session using session()->get('key'); 现在,最后,您可以使用session()->get('key');从Session中获取数据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. 据我说,这是使用Laravel进行多页注册的最佳方法。

Let me know if this helps! 让我知道这是否有帮助! Also let me know if you have any more questions. 如果您还有其他问题,也请与我联系。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM