Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/laravel/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 登录后,为了将用户重定向到注册页面,需要在会话中存储什么?_Php_Laravel - Fatal编程技术网

Php 登录后,为了将用户重定向到注册页面,需要在会话中存储什么?

Php 登录后,为了将用户重定向到注册页面,需要在会话中存储什么?,php,laravel,Php,Laravel,我希望有一个类似于此图像的上下文: 未经验证的用户可以访问congress details页面single.blade.php,并可以为每种票证类型选择所需的数量。单击“下一步”后,如果未通过身份验证,他将转到login.blade.php登录。登录后,他应该被重定向到registration.blade.php 因此,在第一个屏幕中,我从“行动和路线”中看到: <form method="post" action="{{route('congresses.registration',

我希望有一个类似于此图像的上下文:

未经验证的用户可以访问congress details页面single.blade.php,并可以为每种票证类型选择所需的数量。单击“下一步”后,如果未通过身份验证,他将转到login.blade.php登录。登录后,他应该被重定向到registration.blade.php

因此,在第一个屏幕中,我从“行动和路线”中看到:

<form method="post" 
action="{{route('congresses.registration', 
['id' => $congress->id, 'slug' => $congress->slug])}}">


Route::get('/congress/{id}/{slug?}', [
    'uses' => 'FrontController@show',
    'as'   =>'congresses.show'
]);
疑问:您是否知道会话中需要存储哪些数据和内容,以便在登录后将用户重定向到注册页面

使用我目前没有使用会话的代码,用户选择数量并单击“下一步”,然后用户引入电子邮件和密码,单击“确认”,然后用户被重定向到,但它始终显示为Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException

登录控制器:

路线:


我还有默认的laravel验证路由。

A。屏幕1应提交到受验证中间件保护的路由

B.受auth中间件保护的路由应返回屏幕3


A-A。身份验证中间件将处理屏幕2,并在注册/登录时将其移到屏幕3。

我知道您在提交表单时希望使用POST,在这种情况下,您确实需要在会话中存储信息。但是您是否考虑过使用带有GET操作的表单?然后,第一个表单的参数应该是可以作为登录例程的一部分调用的路由的一部分。由于您在提交第一个表单后还没有存储任何信息,我也没有看到不使用POST中的代码味道。谢谢,您能举一个如何正确执行的示例吗?我把表格改为。但是我不知道如何在LoginController中获取参数。但是在第一个屏幕中,用户选择的数量使用RegistrationController存储在一个数组中。谢谢,但这似乎是问题中的问题,出现了错误Symfony\Component\HttpKernel\Exception\MethodNotAllowedHttpException.Gothcha。试着让它成为路线::任何。。。即使只是暂时看看你是否能通过它。或者Route::match['post','get']。。。会更紧。你的路线被严格限制好-作为路线::获取。。。和路线::邮政。。。。如果您将这些更改为Route::any。。。您将通过symphony MehodNotAllowedException(symphony MehodNotAllowedException),因为您将允许任何方法。从该路由:list output(列表输出)中,我们还需要查看中间件列,以确保您拥有web、auth,并查看路由的其他情况。
Route::group(['prefix' => '', 'middleware' => 'auth'], function(){
        Route::post('/congress/{id}/{slug?}/registration', [
        'uses' => 'RegistrationController@storeQuantity',
        'as'   =>'congresses.registration'
    ]);
  }
class LoginController extends Controller
{
    use AuthenticatesUsers;


    protected $redirectTo = '/';

    public function __construct()
    {
        $this->middleware('guest')->except('logout');
    }

    protected function authenticated(Request $request, $user)
    {
        return redirect()->intended($this->redirectTo);

    }
}
Middleware group                                URI                                       NAME                            ACTION
    Get | Head | Web                            /                                          /                      App\Http\Controllers\FrontController@index

    Get | Head | Web                     congress/{id}/{slug?}                   congresses.show               App\Http\Controllers\FrontController@show

    Get | Head | POST | PUT 
    | PATCH | DELETE | 
    OPTIONS | WEB | AUTH             congress/{id}/{slug?}/registration     congresses.registration App\Http\Controllers\RegistrationController@storeQuantity