<commit_before><?php namespace Syscover\Pulsar\Models;

use Illuminate\Support\Facades\Validator;
use Syscover\Pulsar\Traits\TraitModel;
use Sofa\Eloquence\Eloquence;
use Sofa\Eloquence\Mappable;

/**
 * Class CustomField
 *
 * Model with properties
 * <br><b>[id, group, name, field_type, field_type_text, data_type, data_type_text, required, sorting, max_length, pattern, label_size, field_size, data_lang, data]</b>
 *
 * @package     Syscover\Pulsar\Models
 */

class CustomField extends Model
{
    use TraitModel;
    use Eloquence, Mappable;

	protected $table        = '001_026_field';
    protected $primaryKey   = 'id_026';
    protected $suffix       = '026';
    public $timestamps      = false;
    protected $fillable     = ['id_026', 'group_026', 'name_026', 'field_type_026', 'field_type_text_026', 'data_type_026', 'data_type_text_026', 'required_026', 'sorting_026', 'max_length_026', 'pattern_026', 'label_size_026', 'field_size_026', 'data_lang_026', 'data_026'];
    protected $maps         = [];
    protected $relationMaps = [
        'group'   => \Syscover\Pulsar\Models\CustomFieldGroup::class
    ];
    private static $rules   = [
        'name'      => 'required|between:2,100',
        'group'     => 'required',
    ];

    public static function validate($data, $specialRules = [])
    {
        if(isset($specialRules['group'])) static::$rules['group'] = '';

        return Validator::make($data, static::$rules);
    }

    public function scopeBuilder()
    {
        return CustomField::join('001_025_field_group', '001_026_field.group_026', '=', '001_025_field_group.id_025');
    }

    public function getLang()
    {
        // lang_026 comes from json field data_026
        return $this->belongsTo('Syscover\Pulsar\Models\Lang', 'lang_026');
    }

    /**
     * It is likely to be filtered by language, for this use where after method<br>
     * see <a href="http://laravel.com/docs/5.1/eloquent-relationships#querying-relations" target="_blank">relations documentation</a>
     *
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function getValues()
    {
        return $this->hasMany('Syscover\Pulsar\Models\CustomFieldValue', 'field_027');
    }

    public static function addToGetIndexRecords($parameters)
    {
        $query =  CustomField::join('001_025_field_group', '001_026_field.group_026', '=', '001_025_field_group.id_025');

        return $query;
    }
<commit_msg>set getResults<commit_after><?php namespace Syscover\Pulsar\Models;

use Illuminate\Support\Facades\Validator;
use Syscover\Pulsar\Traits\TraitModel;
use Sofa\Eloquence\Eloquence;
use Sofa\Eloquence\Mappable;

/**
 * Class CustomField
 *
 * Model with properties
 * <br><b>[id, group, name, field_type, field_type_text, data_type, data_type_text, required, sorting, max_length, pattern, label_size, field_size, data_lang, data]</b>
 *
 * @package     Syscover\Pulsar\Models
 */

class CustomField extends Model
{
    use TraitModel;
    use Eloquence, Mappable;

	protected $table        = '001_026_field';
    protected $primaryKey   = 'id_026';
    protected $suffix       = '026';
    public $timestamps      = false;
    protected $fillable     = ['id_026', 'group_026', 'name_026', 'field_type_026', 'field_type_text_026', 'data_type_026', 'data_type_text_026', 'required_026', 'sorting_026', 'max_length_026', 'pattern_026', 'label_size_026', 'field_size_026', 'data_lang_026', 'data_026'];
    protected $maps         = [];
    protected $relationMaps = [
        'group'   => \Syscover\Pulsar\Models\CustomFieldGroup::class
    ];
    private static $rules   = [
        'name'      => 'required|between:2,100',
        'group'     => 'required',
    ];

    public static function validate($data, $specialRules = [])
    {
        if(isset($specialRules['group'])) static::$rules['group'] = '';

        return Validator::make($data, static::$rules);
    }

    public function scopeBuilder()
    {
        return CustomField::join('001_025_field_group', '001_026_field.group_026', '=', '001_025_field_group.id_025');
    }

    public function getLang()
    {
        // lang_026 comes from json field data_026
        return $this->belongsTo('Syscover\Pulsar\Models\Lang', 'lang_026');
    }

    /**
     * It is likely to be filtered by language, for this use where after method<br>
     * see <a href="http://laravel.com/docs/5.1/eloquent-relationships#querying-relations" target="_blank">relations documentation</a>
     *
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
     */
    public function getValues()
    {
        return $this->hasMany('Syscover\Pulsar\Models\CustomFieldValue', 'field_027');
    }

    public function getResults()
    {
        return $this->hasMany('Syscover\Pulsar\Models\CustomFieldResult', 'field_028');
    }

    public static function addToGetIndexRecords($parameters)
    {
        $query =  CustomField::join('001_025_field_group', '001_026_field.group_026', '=', '001_025_field_group.id_025');

        return $query;
    }

{'fraction_non_alphanumeric': 0.1385315654066891, 'fraction_numerical': 0.04927765683752226, 'mean_word_length': 3.52461951656222, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 26, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2967887', 'n_tokens_mistral': 1835, 'n_tokens_neox': 1640, 'n_words': 307}