12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- <?php
- namespace App\Http\Requests;
- use Illuminate\Foundation\Http\FormRequest;
- use Illuminate\Support\Arr;
- class AreaRequest 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()
- {
- // $id = (int) optional($this->route('area'))->id;
- $rules = [
- 'name' => 'required|max:255',
- 'area_fence' => 'required',
- 'area_fushe_fence' => 'required',
- 'area_centre' => 'required',
- 'admin_id' => '',
- 'customer_service_time' => 'required',
- 'customer_service_phone' => 'required',
- 'status' => 'required|boolean'
- //
- ];
- if ($this->isMethod('put')) {
- $rules = Arr::only($rules, $this->keys());
- }
- return $rules;
- }
- public function attributes()
- {
- return [
- 'name' => '区域名称',
- 'area_fence' => '骑行区域',
- 'area_centre' => '区域中心',
- 'area_fushe_fence' => '辐射区域',
- 'customer_service_time' => '客服服务时间',
- 'customer_service_phone' => '客服服务手机',
- 'status' => '区域状态'
- ];
- }
- }
|