首页 > 解决方案 > 为什么在没有 CSS LARAVEL 的情况下加载视图

问题描述

我正在发送一个链接以重置密码。链接来了,但是点击链接后,它把我送回视图并且不加载 CSS。我这样做:

控制器:

 public function submitForgetPasswordForm(Request $request)
  {
      $this->validate($request, ['email' => 'required|email|exists:users']);
      $token = Str::random(64);

      DB::table('password_resets')->insert([
          'email' => $request->email, 
          'token' => $token, 
          'created_at' => Carbon::now()
        ]);

      Mail::send('email.forgetPassword', ['token' => $token], function($message) use($request){
          $message->to($request->email);
          $message->from('mail@mail.pl');
          $message->subject('Reset Hasła');
      });

      return back()->with('message', 'Link do resetu hasła został wysłany!');
  }

忘记密码.php

Link for reset password

<a href="https://site.pl/reset-password/{{ $token }}">Reset hasła</a>

忘记密码链接.php

<div class="container">
<div class="row">
    <div class="col-md-8 col-md-offset-2">
        <div class="panel panel-default">
            <div class="panel-heading">Reset Hasła</div>

            <div class="panel-body">
                <form class="form-horizontal" method="POST" action="{{ URL::to('reset-done') }}">
                    {{ csrf_field() }}

                    <input type="hidden" name="token" value="{{ $token }}">

                    <div class="form-group{{ $errors->has('email') ? ' has-error' : '' }}">
                        <label for="email" class="col-md-4 control-label">E-Mail</label>

                        <div class="col-md-6">
                            <input id="email" type="email" class="form-control" name="email" value="{{ $email or old('email') }}" required autofocus>

                            @if ($errors->has('email'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('email') }}</strong>
                                </span>
                            @endif
                        </div>
                    </div>

                    <div class="form-group{{ $errors->has('password') ? ' has-error' : '' }}">
                        <label for="password" class="col-md-4 control-label">Hasło</label>

                        <div class="col-md-6">
                            <input id="password" type="password" class="form-control" name="password" required>

                            @if ($errors->has('password'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('password') }}</strong>
                                </span>
                            @endif
                        </div>
                    </div>

                    <div class="form-group{{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
                        <label for="password-confirm" class="col-md-4 control-label">Potwierdź hasło</label>
                        <div class="col-md-6">
                            <input id="password-confirm" type="password" class="form-control" name="password_confirmation" required>

                            @if ($errors->has('password_confirmation'))
                                <span class="help-block">
                                    <strong>{{ $errors->first('password_confirmation') }}</strong>
                                </span>
                            @endif
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-md-6 col-md-offset-4">
                            <button type="submit" class="btn btn-primary">
                                Zresetuj hasło
                            </button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

网页.php

Route::get('reset-password/{token}', 'Auth\ForgotPasswordController@showResetPasswordForm');

控制器

 public function showResetPasswordForm($token) { 
     return view('auth.forgetPasswordLink', ['token' => $token]);
  }

我做错了什么,点击电子邮件中的链接后,它会将我带到密码重置表格,但没有完善表格,下图。

在此处输入图像描述

标签: laravel

解决方案


推荐阅读