src/PeskyCMF/Traits/DataValidationHelper.php
protected function extractInputFromRules($data, array $rules) {
        $keys = collect($rules)->keys()->map(function ($rule) {
            return explode('.', $rule)[0];
        })->unique()->toArray();
        if (!($data instanceof Request)) {
            $data = collect($data);
        }
        return $data->only($keys);
    }
protected function extractInputFromRules($data, array $rules) {
        $keys = collect($rules)->keys()->map(function ($rule) {
            return explode('.', $rule)[0];
        })->unique()->toArray();
        if (!($data instanceof Request)) {
            $data = collect($data);
        }
        return $data->only($keys);
    }
protected function extractInputFromRules ( $ data , array $ rules ) { $ keys = collect ( $ rules ) -> keys ( ) -> map ( function ( $ rule ) { return explode ( '.' , $ rule ) [ 0 ] ; } ) -> unique ( ) -> toArray ( ) ; if ( ! ( $ data instanceof Request ) ) { $ data = collect ( $ data ) ; } return $ data -> only ( $ keys ) ; }
Get the request input based on the given validation rules.

@param array|Request $data
@param array $rules
@return array
Get the request input based on the given validation rules .