AreaRequest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace App\Http\Requests;
  3. use Illuminate\Foundation\Http\FormRequest;
  4. use Illuminate\Support\Arr;
  5. class AreaRequest extends FormRequest
  6. {
  7. /**
  8. * Determine if the user is authorized to make this request.
  9. *
  10. * @return bool
  11. */
  12. public function authorize()
  13. {
  14. return true;
  15. }
  16. /**
  17. * Get the validation rules that apply to the request.
  18. *
  19. * @return array
  20. */
  21. public function rules()
  22. {
  23. // $id = (int) optional($this->route('area'))->id;
  24. $rules = [
  25. 'name' => 'required|max:255',
  26. 'area_fence' => 'required',
  27. 'area_fushe_fence' => 'required',
  28. 'area_centre' => 'required',
  29. 'admin_id' => '',
  30. 'customer_service_time' => 'required',
  31. 'customer_service_phone' => 'required',
  32. 'status' => 'required|boolean'
  33. //
  34. ];
  35. if ($this->isMethod('put')) {
  36. $rules = Arr::only($rules, $this->keys());
  37. }
  38. return $rules;
  39. }
  40. public function attributes()
  41. {
  42. return [
  43. 'name' => '区域名称',
  44. 'area_fence' => '骑行区域',
  45. 'area_centre' => '区域中心',
  46. 'area_fushe_fence' => '辐射区域',
  47. 'customer_service_time' => '客服服务时间',
  48. 'customer_service_phone' => '客服服务手机',
  49. 'status' => '区域状态'
  50. ];
  51. }
  52. }