51 lines
1.2 KiB
PHP
51 lines
1.2 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Requests;
|
||
|
|
|
||
|
|
use App\Http\Response\ResponseJson;
|
||
|
|
use Illuminate\Contracts\Validation\Validator;
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
use Illuminate\Http\Exceptions\HttpResponseException;
|
||
|
|
|
||
|
|
class SendCoinExchange extends FormRequest
|
||
|
|
{
|
||
|
|
use ResponseJson;
|
||
|
|
/**
|
||
|
|
* 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 [
|
||
|
|
'shipping_no' => 'required',
|
||
|
|
'shipping_company' => 'required',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function messages()
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'shipping_no.required' => '请输入快递单号',
|
||
|
|
// 'shipping_no.numeric' => '输入正确的快递单号',
|
||
|
|
'shipping_company.required' => '请输入快递公司',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function failedValidation(Validator $validator)
|
||
|
|
{
|
||
|
|
$msg = $validator->errors()->first();
|
||
|
|
throw new HttpResponseException($this->failure($msg));
|
||
|
|
}
|
||
|
|
}
|