<commit_before><?php
namespace cmsadmin\models;

class Cat extends \admin\ngrest\base\Model
{
    public $ngRestEndpoint = 'api-cms-cat';

    public function ngRestConfig($config)
    {
        $config->list->field("name", "Name")->text()->required();
        $config->list->field("default_nav_id", "Default-Nav-Id")->text()->required();
        $config->list->field("rewrite", "Rewrite")->text()->required();
        $config->list->field("id", "ID")->text();

        $config->create->copyFrom('list', ['id']);
        $config->update->copyFrom('list', ['id']);

        return $config;
    }

    public static function tableName()
    {
        return 'cms_cat';
    }

    public function rules()
    {
        return [
            [['name', 'rewrite', 'default_nav_id'], 'required']
        ];
    }

    public function scenarios()
    {
        return [
            'restcreate' => ['name', 'rewrite', 'default_nav_id'],
            'restupdate' => ['name', 'rewrite', 'default_nav_id']
        ];
    }
}<commit_msg>[+] get default cat static method<commit_after><?php
namespace cmsadmin\models;

class Cat extends \admin\ngrest\base\Model
{
    public $ngRestEndpoint = 'api-cms-cat';

    public function ngRestConfig($config)
    {
        $config->list->field("name", "Name")->text()->required();
        $config->list->field("default_nav_id", "Default-Nav-Id")->text()->required();
        $config->list->field("rewrite", "Rewrite")->text()->required();
        $config->list->field("id", "ID")->text();

        $config->create->copyFrom('list', ['id']);
        $config->update->copyFrom('list', ['id']);

        return $config;
    }

    public static function tableName()
    {
        return 'cms_cat';
    }

    public function rules()
    {
        return [
            [['name', 'rewrite', 'default_nav_id'], 'required']
        ];
    }

    public function scenarios()
    {
        return [
            'restcreate' => ['name', 'rewrite', 'default_nav_id'],
            'restupdate' => ['name', 'rewrite', 'default_nav_id']
        ];
    }
    
    public static function getDefault()
    {
        return self::find()->where(['is_default' => 1])->one();
    }
}
{'fraction_non_alphanumeric': 0.19808306709265175, 'fraction_numerical': 0.00045641259698767686, 'mean_word_length': 2.5411954765751212, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 48, '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': '5372551', 'n_tokens_mistral': 676, 'n_tokens_neox': 656, 'n_words': 118}