protected function makeModelListFilterDataForAttributeData(ModelAttributeData $attribute, ModelInformationInterface $info)
    {
        $strategy = false;
        $options  = [];

        if ($attribute->cast === AttributeCast::BOOLEAN) {

            $strategy = FilterStrategy::BOOLEAN;

        } elseif ($attribute->type === 'enum') {

            $strategy = FilterStrategy::DROPDOWN;
            $options['values'] = $attribute->values;

        } elseif ($attribute->cast === AttributeCast::STRING) {

            $strategy = FilterStrategy::STRING;

        } elseif ($attribute->cast === AttributeCast::DATE) {

            $strategy = FilterStrategy::DATE;
        }

        if ( ! $strategy) {
            return false;
        }

        return new ModelListFilterData([
            'source'   => $attribute->name,
            'label'    => str_replace('_', ' ', snake_case($attribute->name)),
            'target'   => $attribute->name,
            'strategy' => $strategy,
            'options'  => $options,
        ]);
    }
protected function makeModelListFilterDataForAttributeData(ModelAttributeData $attribute, ModelInformationInterface $info)
    {
        $strategy = false;
        $options  = [];

        if ($attribute->cast === AttributeCast::BOOLEAN) {

            $strategy = FilterStrategy::BOOLEAN;

        } elseif ($attribute->type === 'enum') {

            $strategy = FilterStrategy::DROPDOWN;
            $options['values'] = $attribute->values;

        } elseif ($attribute->cast === AttributeCast::STRING) {

            $strategy = FilterStrategy::STRING;

        } elseif ($attribute->cast === AttributeCast::DATE) {

            $strategy = FilterStrategy::DATE;
        }

        if ( ! $strategy) {
            return false;
        }

        return new ModelListFilterData([
            'source'   => $attribute->name,
            'label'    => str_replace('_', ' ', snake_case($attribute->name)),
            'target'   => $attribute->name,
            'strategy' => $strategy,
            'options'  => $options,
        ]);
    }
protected function makeModelListFilterDataForAttributeData ( ModelAttributeData $ attribute , ModelInformationInterface $ info ) { $ strategy = false ; $ options = [ ] ; if ( $ attribute -> cast === AttributeCast :: BOOLEAN ) { $ strategy = FilterStrategy :: BOOLEAN ; } elseif ( $ attribute -> type === 'enum' ) { $ strategy = FilterStrategy :: DROPDOWN ; $ options [ 'values' ] = $ attribute -> values ; } elseif ( $ attribute -> cast === AttributeCast :: STRING ) { $ strategy = FilterStrategy :: STRING ; } elseif ( $ attribute -> cast === AttributeCast :: DATE ) { $ strategy = FilterStrategy :: DATE ; } if ( ! $ strategy ) { return false ; } return new ModelListFilterData ( [ 'source' => $ attribute -> name , 'label' => str_replace ( '_' , ' ' , snake_case ( $ attribute -> name ) ) , 'target' => $ attribute -> name , 'strategy' => $ strategy , 'options' => $ options , ] ) ; }
Makes list filter data given attribute data.

@param ModelAttributeData                         $attribute
@param ModelInformationInterface|ModelInformation $info
@return ModelListFilterData|false
Makes list filter data given attribute data .