<commit_before><?php

use Zhiyi\Plus\Models\Role;
use Illuminate\Database\Seeder;
use Zhiyi\Plus\Models\Permission;

class RoleSeeder extends Seeder
{
    /**
     * 开始运行 seeder.
     *
     * @return void
     * @author <NAME> <<EMAIL>>
     */
    public function run()
    {
        // 权限节点.
        $this->call(PermissionSeeder::class);

        // roles
        $this->createFounderRole();
        $this->createOwnerRole();
    }

    /**
     * 创始人角色.
     *
     * @return void
     * @author <NAME> <<EMAIL>>
     */
    protected function createFounderRole()
    {
        $role = Role::create([
            'name' => 'founder',
            'display_name' => '创始人',
            'description' => '站点创始人',
        ]);

        $perms = Permission::all();

        $role->perms()->sync($perms);
    }

    /**
     * 业主，普通用户角色.
     *
     * @return void
     * @author <NAME> <<EMAIL>>
     */
    protected function createOwnerRole()
    {
        $role = Role::create([
            'name' => 'owner',
            'display_name' => '普通用户',
            'description' => '普通用户',
        ]);

        $perms = Permission::where('name', 'not like', 'admin:%')->get();

        $role->perms()->sync($perms);
    }
}<commit_msg>add a default user role<commit_after><?php

use Zhiyi\Plus\Models\Role;
use Illuminate\Database\Seeder;
use Zhiyi\Plus\Models\Permission;

class RoleSeeder extends Seeder
{
    /**
     * 开始运行 seeder.
     *
     * @return void
     * @author <NAME> <<EMAIL>>
     */
    public function run()
    {
        // 权限节点.
        $this->call(PermissionSeeder::class);

        // roles
        $this->createFounderRole();
        $this->createOwnerRole();
        $this->createDisabledRole();
    }

    /**
     * 创始人角色.
     *
     * @return void
     * @author <NAME> <<EMAIL>>
     */
    protected function createFounderRole()
    {
        $role = Role::create([
            'name' => 'founder',
            'display_name' => '创始人',
            'description' => '站点创始人',
        ]);

        $perms = Permission::all();

        $role->perms()->sync($perms);
    }

    /**
     * 业主，普通用户角色.
     *
     * @return void
     * @author <NAME> <<EMAIL>>
     */
    protected function createOwnerRole()
    {
        $role = Role::create([
            'name' => 'owner',
            'display_name' => '普通用户',
            'description' => '普通用户',
        ]);

        $perms = Permission::where('name', 'not like', 'admin:%')->get();

        $role->perms()->sync($perms);
    }

    /**
     * 被禁用的用户
     * @return [type] [description]
     */
    protected function createDisabledRole()
    {
        $role = Role::create([
            'name' => 'disabler',
            'display_name' => '禁用用户',
            'description' => '被禁止登录用户， 需要手动设置'
        ]);
    }
}
{'fraction_non_alphanumeric': 0.17621776504297995, 'fraction_numerical': 0.0, 'mean_word_length': 1.738235294117647, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 53, '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': '1979917', 'n_tokens_mistral': 960, 'n_tokens_neox': 980, 'n_words': 159}