I want to redirect to view if a certain condition is not met. Check code:
if($request->get('files') == 'yes' && $request->file('file_name') == null){
return Redirect::to('brief/'.$id."/edit")
->withErrors('errors',"Mention file")
->withInput();
}
It prints array as:
Illuminate\Support\ViewErrorBag {#239
#bags: array:1 [
"Mention file" => Illuminate\Support\MessageBag {#240
#messages: array:1 [
0 => array:1 [
0 => "errors"
]
]
#format: ":message"
}
]
At view end I am doing:
@if (count($errors) > 0)
<div style="margin-top: 10%;" class="alert alert-danger">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
It is not printing the message Mention File
Validator::make($inputs, $rules)?