1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?php
- namespace App\Http\Validate\Buy;
- use App\Http\Validate\BaseValidate;
- use Illuminate\Support\Facades\Validator;
- class BuyControllerValidate extends BaseValidate
- {
-
- public function getCateList($data)
- {
- $validate = Validator::make($data,
- [
- "source"=>"required",
- ]
- );
- if($validate->fails()){
-
- $this->setError($validate->errors()->first());
- return false;
- }
- return true;
- }
-
- public function getGoodsList($data)
- {
- $validate = Validator::make($data,
- [
- "source"=>"required",
- "cat_id"=>"required|integer",
- "page"=>"required|integer",
- "page_size"=>"required|integer",
- ]
- );
- if($validate->fails()){
-
- $this->setError($validate->errors()->first());
- return false;
- }
- return true;
- }
-
- public function getGoodsDetail($data)
- {
- $validate = Validator::make($data,
- [
- "source"=>"required",
- "goods_id"=>"required",
- ]
- );
- if($validate->fails()){
-
- $this->setError($validate->errors()->first());
- return false;
- }
- return true;
- }
-
- public function getGoodsSearch($data)
- {
- $validate = Validator::make($data,
- [
- "source"=>"required",
- "keyword"=>"required",
- "page"=>"required",
- "page_size"=>"required",
- ]
- );
- if($validate->fails()){
-
- $this->setError($validate->errors()->first());
- return false;
- }
- return true;
- }
- }
|