protected function createFilter($key, $value)
    {
        if ($key == 'role') {
            return function (Attachment $attachment) use ($value) {
                return $attachment->getRole() == $value;
            };
        }

        if ($key == 'mimetype' || $key == 'type') {
            return function (Attachment $attachment) use ($value) {
                return $attachment->is($value);
            };
        }

        throw new UnsupportedParameterException("Filtering by key '$key' is not supported.'");
    }
protected function createFilter($key, $value)
    {
        if ($key == 'role') {
            return function (Attachment $attachment) use ($value) {
                return $attachment->getRole() == $value;
            };
        }

        if ($key == 'mimetype' || $key == 'type') {
            return function (Attachment $attachment) use ($value) {
                return $attachment->is($value);
            };
        }

        throw new UnsupportedParameterException("Filtering by key '$key' is not supported.'");
    }
protected function createFilter ( $ key , $ value ) { if ( $ key == 'role' ) { return function ( Attachment $ attachment ) use ( $ value ) { return $ attachment -> getRole ( ) == $ value ; } ; } if ( $ key == 'mimetype' || $ key == 'type' ) { return function ( Attachment $ attachment ) use ( $ value ) { return $ attachment -> is ( $ value ) ; } ; } throw new UnsupportedParameterException ( "Filtering by key '$key' is not supported.'" ) ; }
Create a filter Closure to realize the where method.

@param string $key
@param string $value

@return \Closure
Create a filter Closure to realize the where method .