我需要响应json消息()
class StoryRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'name' => 'required|min:3|max:255|unique:stories',
'categories' => 'required',
'image' => 'mimes:jpeg,bmp,png, jpg',
];
}
public function messages()
{
return response()->json([
'image.mimes' => 'only .jpg, .png, .jpeg',
'name.required' => 'please name',
'name.min' => 'min 3',
'name.max' => 'max 255',
'name.unique' => 'name unique',
'categories.required' => 'please choose categories'
]);
}
}
答案 0 :(得分:0)
尝试一下return redirect('/home')->with('success', 'Password Updated Successfully');