1
私の一部で$ errors変数にアクセスしているLaravel 5.2に問題があります。私はミドルウェアウェブで私のルートをラップしている
routes.phpの
。
と私のauth.blade.phpここ
<div class="col-md-4">
<div class="panel panel-{{ $errors->all() ? 'danger' : 'default'}}">
<div class="panel-heading">
`enter code here`<h2 class="panel-title">@yield('heading')</h2>
</div>
<div class="panel-body">
@if($errors->all())
<div class="alert alert-danger">
<strong>We found some errors</strong>
<ul>
@foreach($errors->all() as $errors)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
@yield('content')
</div>
</div>
</div>
で
は@extends('layouts.auth')
@section('title','Login')
@section('heading','Welcome Please login')
@section('content')
{!! Form::open() !!}
<div class="form-group">
{!! Form::label('email') !!}
{!! Form::text('email', null, ['class' => 'form-control']) !!}
</div>
<div class="form-group">
{!! Form::label('password') !!}
{!! Form::password('password', ['class' => 'form-control']) !!}
</div>
{!! Form::submit('Login', ['class' => 'btn btn-primary']) !!}
<a href="#" class="small">Forgot password?</a>
{!! Form::close() !!}
@endsection
私それだけで同じページBUITにリダイレクトログイン]をクリックし、部分的に私のログインのためのコードですエラーを点滅させない?
私はそれがこのエラー
こんにちはアレクセイ、グループを削除すると、同じ問題が発生します。フォームをポストすると、同じページにリダイレクトされ、エラーは表示されません。 – tomb1994
あなたがそれらを表示しようとしているときに何かエラーがありますか?私は多分すべてが大丈夫であることを意味し、それはあなたがどんなエラーメッセージも持っていない理由です? )また、@if($ errors-> all())の代わりにもっと明示的な '@if(count($ errors)> 0)'を使う方が良いと思います。 –
私はもっと暗黙のうちにこれを作ったのですが、私は\ Illuminate \ Session \ Middleware \ StartSession :: classを移動してkernel.phpを変更し、 \ Illuminate \ View \ Middleware \ ShareErrorsFromSession :: class、 ミドルウェアに$ミドルウェアグループのうち、私は元の方法に戻しました。このエラーが発生しました 未定義変数:エラー 未定義の変数:error(表示:/ home/vagrant/Code/hub/public/themes /デフォルト/ views/layouts/auth.blade.php)(表示:/home/vagrant/Code/hub/public/themes/default/views/layouts/auth.blade.php) – tomb1994