mini-aspire/app/Http/Requests/API/BaseAPIRequest.php
/**
     * Handle fields not include in rules
     * @return errors
    */
Handle fields not include in rules
@return errors
Handle fields not include in rules @return errors
protected function passedValidation(){
        $rules = $this->rules();
        $allowFields = [];
        foreach($this->rules() as $key => $rule){
            if(! in_array($key, $allowFields)){
                array_push($allowFields, $key);
            }
        }
        $deniedFields = [];
        foreach($this->validationData() as $key => $rule){
            if(! in_array($key, $allowFields)){
                array_push($deniedFields, ucfirst($key)." is not allow in request!");
            }
        }
        if(count($deniedFields)){
            throw new HttpResponseException(
                response()->json(['errors' => $deniedFields], JsonResponse::HTTP_UNPROCESSABLE_ENTITY)
            );
        }
    }
protected function passedValidation ( ) { $ rules = $ this -> rules ( ) ; $ allowFields = [ ] ; foreach ( $ this -> rules ( ) as $ key => $ rule ) { if ( ! in_array ( $ key , $ allowFields ) ) { array_push ( $ allowFields , $ key ) ; } } $ deniedFields = [ ] ; foreach ( $ this -> validationData ( ) as $ key => $ rule ) { if ( ! in_array ( $ key , $ allowFields ) ) { array_push ( $ deniedFields , ucfirst ( $ key ) . "  is not allow in request! " ) ; } } if ( count ( $ deniedFields ) ) { throw new HttpResponseException ( response ( ) -> json ( [ 'errors' => $ deniedFields ] , JsonResponse :: HTTP_UNPROCESSABLE_ENTITY ) ) ; } }
Handle fields not include in rules
 @return errors
Handle fields not include in rules @return errors
// List all fields is allow in rules // List all fileds in request // Response to client