You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aquaculture/app/Http/Requests/AddressRequest.php

46 lines
1.0 KiB

<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class AddressRequest 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',
'phone'=>'regex:/^1[34578][0-9]{9}$/',
'province_id' => 'required',
'city_id' => 'required',
'detail_address' => 'required',
];
}
public function messages()
{
return [
'name.required' => '收货人名字不能为空',
'phone.regex' => '手机号码格式不正确',
'province_id.required' => '省区不能为空',
'city_id.required' => '城市不能为空',
'detail_address.required' => '详细收货地址不能为空',
];
}
}