删除后,Laravel Auth无法正常工作

时间:2018-10-07 11:44:52

标签: laravel laravel-5 laravel-authentication

我已将本地laravel应用程序移至生产环境。在我的本地PC上,注册功能运行良好(使用Laravel Auth)。在远程主机上,当我提交注册表时,什么都没有。没有验证错误或其他。我的申请有什么问题?

enter image description here

在此过程中我得到了404。我的注册路线在这里:

Route::get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
Route::post('register', 'Auth\RegisterController@register');

这是我register.blade.php文件的内容:

<form id="js-validation-signup" action="{{ route('register') }}" method="post">
                        @csrf
                        <div class="py-3">

                            <div class="form-group">
                                <input type="text"
                                       class="form-control form-control-lg form-control-alt{{ $errors->has('first_name') ? ' is-invalid' : '' }}"
                                       id="first_name" name="first_name" placeholder="{{ __('First Name') }}"
                                       value="{{ old('first_name') }}" autocomplete="off">
                                @if ($errors->has('first_name'))
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $errors->first('first_name') }}</strong>
                                    </span>
                                @endif
                            </div>

                            <div class="form-group">
                                <input type="text"
                                       class="form-control form-control-lg form-control-alt{{ $errors->has('name') ? ' is-invalid' : '' }}"
                                       id="name" name="name" placeholder="{{ __('Name') }}"
                                       value="{{ old('name') }}" autocomplete="off">
                                @if ($errors->has('name'))
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $errors->first('name') }}</strong>
                                    </span>
                                @endif
                            </div>

                            <div class="form-group">
                                <input type="email"
                                       class="form-control form-control-lg form-control-alt{{ $errors->has('email') ? ' is-invalid' : '' }}"
                                       id="email" name="email" placeholder="{{ __('E-Mail Address') }}"
                                       autocomplete="off" value="{{ old('email') }}">
                                @if ($errors->has('email'))
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $errors->first('email') }}</strong>
                                    </span>
                                @endif
                            </div>

                            <div class="form-group">
                                <input type="password"
                                       class="form-control form-control-lg form-control-alt{{ $errors->has('password') ? ' is-invalid' : '' }}"
                                       id="password" name="password" placeholder="{{ __('Password') }}">
                                @if ($errors->has('password'))
                                    <span class="invalid-feedback" role="alert">
                                        <strong>{{ $errors->first('password') }}</strong>
                                    </span>
                                @endif
                            </div>

                            <div class="form-group">
                                <input type="password" class="form-control form-control-lg form-control-alt"
                                       id="password_confirmation" name="password_confirmation"
                                       placeholder="{{ __('Confirm Password') }}">
                            </div>

                            <div class="form-group">
                                <div class="input-group">
                                    <input class="form-control form-control-lg form-control-alt{{ $errors->has('application_name') ? ' is-invalid' : '' }}"
                                           id="application_name"
                                           name="application_name" type="text"
                                           placeholder="{{ __('Application Name') }}" autocomplete="off"
                                           value="{{ old('application_name')  }}">
                                    <div class="input-group-append">
                                        <span class="input-group-text input-group-text-alt">.example.com</span>
                                    </div>
                                    @if ($errors->has('application_name'))
                                        <span class="invalid-feedback" role="alert">
                                        <strong>{{ $errors->first('application_name') }}</strong>
                                    </span>
                                    @endif
                                </div>
                            </div>

                            <div class="form-group">
                                <div class="custom-control custom-checkbox custom-control-primary">
                                    <input type="checkbox" class="custom-control-input" id="signup-terms"
                                           name="signup-terms">
                                    <label class="custom-control-label" for="signup-terms">I agree to Terms &amp;
                                        Conditions</label>
                                </div>
                            </div>

                        </div>
                        <div class="form-group">
                            <button type="submit" class="btn btn-block btn-hero-lg btn-hero-primary">
                                <i class="fa fa-fw fa-user-plus mr-1"></i> Sign Up
                            </button>
                            <p class="mt-3 mb-0 d-lg-flex justify-content-lg-between">
                                <a class="btn btn-sm btn-light d-block d-lg-inline-block mb-1" href="#">
                                    <i class="fa fa-book text-muted mr-1"></i> Read Terms
                                </a>
                            </p>
                        </div>
                    </form>

2 个答案:

答案 0 :(得分:2)

我认为我在login上遇到了同样的问题。

我的问题是我使用了Laravel的身份验证登录名,并且Auth/LoginController内有一个
use AuthenticatesUsers使用供应商和Auth文件夹中的特征,当我想使用git clone在另一台计算机上获取项目,并使用composer install为我的供应商更改为项目的项目使用已安装的软件包时默认,并将AuthenticatesUsers特征中的所有登录代码删除并更改为默认

答案 1 :(得分:0)

route()函数用于命名的路由。
看来您已命名您的get路线,但未使用相应的后继路线进行命名。使用POST方法访问 route('register')将导致404错误。
尝试也为发布路线命名,或使用 action('Auth \ RegisterController @ register')

http://myorg.crm.dynamics.com/main.aspx?etn=contact&pagetype=entitylist&viewid={00000000-0000-0000-00AA-000010001004}&viewtype=1039&navbar=off&cmdbar=false