public static function getAdvancedSearchFields($postType)
    {
        $postTypeFields = json_decode(DB::table('post_type')->where("slug", $postType)->first()->fields);
        $advancedSearchFields = array();
        foreach ($postTypeFields as $fieldArray){
            if($fieldArray->type->inputType == "image"
                || $fieldArray->type->inputType == "file"
                || $fieldArray->type->inputType == "editor"
                || $fieldArray->type->inputType == "checkbox"
                || $fieldArray->type->inputType == "dropdown"
                || $fieldArray->type->inputType == "radio"
            ) {
                continue;
            }
            $properties = array();
            foreach ($fieldArray as $key => $field){
                if($key == "name") {
                    $properties['name'] = $field;
                }else if($key == "type") {
                    $properties['type'] = $field->inputType;
                }else if($key == "slug") {
                    $properties['db-column'] = $field;
                }
            }
            if(count($properties)) {
                array_push($advancedSearchFields, $properties);
            }
        }
        return $advancedSearchFields;
    }
public static function getAdvancedSearchFields($postType)
    {
        $postTypeFields = json_decode(DB::table('post_type')->where("slug", $postType)->first()->fields);
        $advancedSearchFields = array();
        foreach ($postTypeFields as $fieldArray){
            if($fieldArray->type->inputType == "image"
                || $fieldArray->type->inputType == "file"
                || $fieldArray->type->inputType == "editor"
                || $fieldArray->type->inputType == "checkbox"
                || $fieldArray->type->inputType == "dropdown"
                || $fieldArray->type->inputType == "radio"
            ) {
                continue;
            }
            $properties = array();
            foreach ($fieldArray as $key => $field){
                if($key == "name") {
                    $properties['name'] = $field;
                }else if($key == "type") {
                    $properties['type'] = $field->inputType;
                }else if($key == "slug") {
                    $properties['db-column'] = $field;
                }
            }
            if(count($properties)) {
                array_push($advancedSearchFields, $properties);
            }
        }
        return $advancedSearchFields;
    }
public static function getAdvancedSearchFields ( $ postType ) { $ postTypeFields = json_decode ( DB :: table ( 'post_type' ) -> where ( "slug" , $ postType ) -> first ( ) -> fields ) ; $ advancedSearchFields = array ( ) ; foreach ( $ postTypeFields as $ fieldArray ) { if ( $ fieldArray -> type -> inputType == "image" || $ fieldArray -> type -> inputType == "file" || $ fieldArray -> type -> inputType == "editor" || $ fieldArray -> type -> inputType == "checkbox" || $ fieldArray -> type -> inputType == "dropdown" || $ fieldArray -> type -> inputType == "radio" ) { continue ; } $ properties = array ( ) ; foreach ( $ fieldArray as $ key => $ field ) { if ( $ key == "name" ) { $ properties [ 'name' ] = $ field ; } else if ( $ key == "type" ) { $ properties [ 'type' ] = $ field -> inputType ; } else if ( $ key == "slug" ) { $ properties [ 'db-column' ] = $ field ; } } if ( count ( $ properties ) ) { array_push ( $ advancedSearchFields , $ properties ) ; } } return $ advancedSearchFields ; }
Setup advanced search fields to be used in Posts advanced search.

@param string $postType Slug of Post Type (ex. post_services)

@return array
Setup advanced search fields to be used in Posts advanced search .