1public function rules()
2{
3 return [
4 'title' => 'required|unique:posts|max:255',
5 'body' => 'required',
6 ];
7}
8
9public function messages()
10{
11 return [
12 'title.required' => 'A title is required',
13 'body.required' => 'A message is required',
14 ];
15}