123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace App\Http\Validate\Order;
- use App\Http\Validate\BaseValidate;
- use Illuminate\Support\Facades\Validator;
- class OrderControllerValidate extends BaseValidate
- {
- /**
- * 订单列表参数校验
- * @param $data
- */
- public function getOrderList($data)
- {
- $validate = Validator::make($data,
- [
- "page"=>"required|integer",
- "page_size"=>"required|integer",
- ]
- );
- if($validate->fails()){
- //验证错误
- $this->setError($validate->errors()->first());
- return false;
- }
- return true;
- }
- /**
- * 订单详情参数校验
- * @param $data
- * @return bool
- */
- public function getOrderDetail($data)
- {
- $validate = Validator::make($data,
- [
- "order_id"=>"required|integer",
- ]
- );
- if($validate->fails()){
- //验证错误
- $this->setError($validate->errors()->first());
- return false;
- }
- return true;
- }
- }
|