Laravel无法使用表单和令牌呈现视图

时间:2017-07-21 09:53:21

标签: php laravel

我尝试使用表单重置密码渲染视图,而laravel无法执行此操作。没有错误但查看全白。如果我用简单的h1 laravel渲染它,将视图更改为其他视图。

所以,我猜问题就在于令牌。

路线是这样的:

Route::get('/password/reset/{token}','Auth\AdminResetPasswordController@showResetForm')->name('admin.password.reset');    

控制器起作用:

public function showResetForm(Request $request, $token = null)
    {
        return view('auth.passwords.reset-admin')->with(
            ['token' => $token, 'email' => $request->email]
        );
    }

视图文件位于

/resources/views/auth/passwords/reset-admin.blade.php

非常感谢。

在渲染过程结束时执行以下函数:

public function handleShutdown()
    {
        if (! is_null($error = error_get_last()) && $this->isFatal($error['type'])) {
            $this->handleException($this->fatalExceptionFromError($error, 0));
        }
    }

刀片内容:

@extends('backend.public.includes.head')
@section('content')
<div class="container">
    <div class="row">
        <div class="col-md-8 col-md-offset-2">
            <div class="panel panel-default">
                <div class="panel-heading">ADMIN Reset Password</div>

                <div class="panel-body">
                    @if (session('status'))
                        <div class="alert alert-success">
                            {{ session('status') }}
                        </div>
                    @endif

                    <form class="form-horizontal" role="form" method="POST" action="{{ route('admin.password.request') }}">
                        {{ 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 Address</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">Password</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">Confirm Password</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">
                                    Reset Password
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
@endsection

Extrainfo: 获取脚本但不渲染表单。

error.loc上的错误

2017/07/14 11:19:35 [error] 5048#5048: *1 FastCGI sent in stderr: "PHP message: PHP Warning:  require(/home/vagrant/Code/name/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /home/vagrant/Code/name/bootstrap/autoload.php on line 17
PHP message: PHP Stack trace:
PHP message: PHP   1. {main}() /home/vagrant/Code/name/public/index.php:0
PHP message: PHP   2. require() /home/vagrant/Code/name/public/index.php:22

如果我在视图上添加类似alskdaslkd的内容,则会渲染它。

解决

问题是我使用extend to head(我有所有脚本)但是在/ layouts / default中我定义了我的&#34;结构&#34;使用@yield(&#39;内容&#39;)所以如果我把@extends(&#39; backend.public.layouts.default&#39;)放在刀片的顶部,我可以使用@section(&# 39;内容&#39)

0 个答案:

没有答案