StoreChatRequest.php 630 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace App\Http\Requests;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. class StoreChatRequest extends FormRequest
  5. {
  6. public function authorize()
  7. {
  8. return true;
  9. }
  10. public function rules()
  11. {
  12. return [
  13. 'title' => 'required|string|max:255',
  14. 'user_id' => 'required|string|exists:user_infos,userid'
  15. ];
  16. }
  17. public function messages()
  18. {
  19. return [
  20. 'title.required' => '聊天标题不能为空',
  21. 'title.max' => '聊天标题不能超过255个字符',
  22. 'user_id.exists' => '用户不存在'
  23. ];
  24. }
  25. }