简体   繁体   English

使用Laravel 5.6在同一页面上登录和注册?

[英]Login and Register on same page with Laravel 5.6?

So I'm creating an e-commerce website and working with Laravel 5.6 which I do not have as much experience as I would be comfortable with even though I took a Udemy course on it. 因此,我正在创建一个电子商务网站并使用Laravel 5.6,尽管我参加了Udemy的课程,但我并没有那么多的经验。

So if an unauthorized user if(!Auth::check()) goes to the root directory / there is a login form along with a Sign in and Sign up button. 因此,如果未经授权的用户if(!Auth::check())转到根目录/则会有一个登录表单以及“ Sign in和“ Sign up按钮。 The Sign up button is supposed to then change the form for signing in to sign up with additional fields like first and last name. 然后,应该使用“ Sign up按钮来更改登录表单,以使用其他字段(例如名字和姓氏)进行注册。

What is the most painless way to do this in Laravel 5.6? 在Laravel 5.6中最轻松的方法是什么? I was thinking maybe I could somehow utilize @section and @yield but I'm honestly not sure and I don't want to mess anything up. 我当时在想,也许我可以以某种方式利用@section@yield但是老实说我不确定,我也不想弄乱任何东西。

Create one page: 创建一页:

  1. Create Login Form in this page 在此页面中创建登录表单
  2. Create Register Form in this page too 在此页面上也创建注册表
  3. Hide Register Form using CSS or whatever 使用CSS或其他方法隐藏注册表
  4. Create event on Sign up button to hide Login Form and Show Register form using JS 在注册按钮上创建事件以使用JS隐藏登录表单和显示注册表单

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

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