public function roleId(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')));
        }

        $exists = array_filter($values, function ($role_id) {

            if ($role_id == 0) {
                return true;
            }

            $role = $this->role->get($role_id);
            return isset($role['role_id']);
        });

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

        return true;
    }
public function roleId(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')));
        }

        $exists = array_filter($values, function ($role_id) {

            if ($role_id == 0) {
                return true;
            }

            $role = $this->role->get($role_id);
            return isset($role['role_id']);
        });

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

        return true;
    }
public function roleId ( 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' ) ) ) ; } $ exists = array_filter ( $ values , function ( $ role_id ) { if ( $ role_id == 0 ) { return true ; } $ role = $ this -> role -> get ( $ role_id ) ; return isset ( $ role [ 'role_id' ] ) ; } ) ; if ( $ count != count ( $ exists ) ) { return $ this -> translation -> text ( '@name is unavailable' , array ( '@name' => $ this -> translation -> text ( 'Role' ) ) ) ; } return true ; }
Validates the role ID condition
@param array $values
@return boolean|string
Validates the role ID condition