I can print error message in views with this code
return Redirect::back()->withInput()->withErrors($v);
Here is my view
@if(Session::has('errors'))
<div class="row">
<div class="col-md-12 col-sm-12">
<div class="alert alert-warning">
<button class="close" data-close="alert"></button>
<ul>
@foreach($errors->all() as $error)
<li><strong>{{ $error }}</li></strong>
@endforeach
</ul>
</div>
</div>
</div>
@else
no error
@endif
But I can't print error if I use this code instead
return Redirect::back()->withInput()->withCok($v);
Here is the view
@if(Session::has('cok'))
<div class="row">
<div class="col-md-12 col-sm-12">
<div class="alert alert-warning">
<button class="close" data-close="alert"></button>
<ul>
@foreach($cok->all() as $error)
<li><strong>{{ $error }}</li></strong>
@endforeach
</ul>
</div>
</div>
</div>
@else
no error
@endif
I always get no error.
- So how I can use
withCok($v)
instead ofwithErrors($v)
? - Why this thing happen ?
- Is this because
withCok($v)
does not create$cok
variable ? while$errors
already there by default ?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1ODyqTY
via IFTTT
Aucun commentaire:
Enregistrer un commentaire