public function filter(Model $model, $key = null)
    {
        if (is_null($this->filter)) {
            $this->filter = Filter::fromSchema($this->schema());
        }

        $this->applyHook('filtering', $model, $key);
        $result = $this->filter->run($model, $key);
        $this->applyHook('filtered', $model, $key);

        return $result;
    }
public function filter(Model $model, $key = null)
    {
        if (is_null($this->filter)) {
            $this->filter = Filter::fromSchema($this->schema());
        }

        $this->applyHook('filtering', $model, $key);
        $result = $this->filter->run($model, $key);
        $this->applyHook('filtered', $model, $key);

        return $result;
    }
public function filter ( Model $ model , $ key = null ) { if ( is_null ( $ this -> filter ) ) { $ this -> filter = Filter :: fromSchema ( $ this -> schema ( ) ) ; } $ this -> applyHook ( 'filtering' , $ model , $ key ) ; $ result = $ this -> filter -> run ( $ model , $ key ) ; $ this -> applyHook ( 'filtered' , $ model , $ key ) ; return $ result ; }
Filter model data with functions to cleanse, prepare and validate data. When key argument specified, filter will run partially for specified key only.

@param \Norm\Model   $model

@param string $key Key field of model

@return bool True if success and false if fail
Filter model data with functions to cleanse prepare and validate data . When key argument specified filter will run partially for specified key only .