Answer the question
In order to leave comments, you need to log in
How to catch validation in laravel5?
There is a controller:
...
public function index(TestService $service)
{
return view('test', [
'name' => 'James'
]);
}
public function create(TestRequest $request)
{
echo '<pre>';
print_r($request->all());
die();
}
...
class TestRequest extends Request
{
public function authorize()
{
return true;
}
public function rules()
{
return [
'email' => 'required'
];
}
public function sanitize()
{
return $this->all();
}
}
{{ form_open({'url': 'test/name'}) }}
<div>
{{ form_text('email') }}
</div>
<div>
{{ form_submit('Send') }}
</div>
{{ form_close() }}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question