0
我需要在我的一个控制器中进行验证 - 我无法为这个特定问题使用请求类 - 所以我想弄清楚如何定义自定义验证消息在控制器中。Larval 5.2:在控制器中定义自定义错误消息
我已经找遍了,找不到任何暗示它可能的东西。
可能吗?我会怎么做?
public function store(Request $request)
{
$this->validate($request, [
'title' => 'required|unique:posts|max:255',
'body' => 'required',
]);
// can I create custom error messages for each input down here?
// something like...
$this->validate($errors, [
'title' => 'Please enter a title',
'body' => 'Please enter some text',
]);
}
我不能使用请求类对于此问题,它在控制器来完成。 – timgavin