public function stateId(array $values)
    {
        $count = count($values);
        $ids = array_filter($values, 'ctype_digit');

        if ($count != count($ids)) {
            return $this->translation->text('@field has invalid value', array(
                '@field' => $this->translation->text('Condition')));
        }

        $existing = array_filter($values, function ($state_id) {
            $state = $this->state->get($state_id);
            return isset($state['state_id']);
        });

        if ($count != count($existing)) {
            return $this->translation->text('@name is unavailable', array(
                '@name' => $this->translation->text('Country state')));
        }

        return true;
    }
public function stateId(array $values)
    {
        $count = count($values);
        $ids = array_filter($values, 'ctype_digit');

        if ($count != count($ids)) {
            return $this->translation->text('@field has invalid value', array(
                '@field' => $this->translation->text('Condition')));
        }

        $existing = array_filter($values, function ($state_id) {
            $state = $this->state->get($state_id);
            return isset($state['state_id']);
        });

        if ($count != count($existing)) {
            return $this->translation->text('@name is unavailable', array(
                '@name' => $this->translation->text('Country state')));
        }

        return true;
    }
public function stateId ( array $ values ) { $ count = count ( $ values ) ; $ ids = array_filter ( $ values , 'ctype_digit' ) ; if ( $ count != count ( $ ids ) ) { return $ this -> translation -> text ( '@field has invalid value' , array ( '@field' => $ this -> translation -> text ( 'Condition' ) ) ) ; } $ existing = array_filter ( $ values , function ( $ state_id ) { $ state = $ this -> state -> get ( $ state_id ) ; return isset ( $ state [ 'state_id' ] ) ; } ) ; if ( $ count != count ( $ existing ) ) { return $ this -> translation -> text ( '@name is unavailable' , array ( '@name' => $ this -> translation -> text ( 'Country state' ) ) ) ; } return true ; }
Validates the country state condition
@param array $values
@return boolean|string
Validates the country state condition