• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

miaoxing / user / 4299281913

pending completion
4299281913

push

github

twinh
ci: 更新依赖版本

21 of 47 branches covered (44.68%)

80 of 620 relevant lines covered (12.9%)

1.41 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/UserPlugin.php
1
<?php
2

3
namespace Miaoxing\User;
4

5
use Miaoxing\Admin\Service\AdminMenu;
6
use Miaoxing\Plugin\Service\User;
7

8
class UserPlugin extends \Miaoxing\Plugin\BasePlugin
9
{
10
    protected $name = '用户';
11

12
    protected $description = '';
13

14
    protected $code = 204;
15

16
    protected $adminNavId = 'user';
17

18
    public function onAdminMenuGetMenus(AdminMenu $menu)
19
    {
20
        $user = $menu->child('user');
×
21

22
        $users = $user->addChild()->setLabel('用户管理')->setUrl('admin/users')->setSort(1000)->setApis([
×
23
            'GET admin-api/users',
×
24
        ]);
25
        $users->addChild()->setLabel('编辑')->setUrl('admin/users/[id]/edit')->setApis([
×
26
            'GET admin-api/users/[id]',
×
27
            'PATCH admin-api/users/[id]',
28
        ]);
29
    }
30

31
    public function onLinkToGetLinks(&$links, &$types)
32
    {
33
        $types['user'] = [
×
34
            'name' => '用户',
35
            'sort' => 600,
36
        ];
37

38
        $links[] = [
×
39
            'typeId' => 'user',
40
            'name' => '个人中心',
41
            'url' => 'user',
42
        ];
43

44
        $links[] = [
×
45
            'typeId' => 'user',
46
            'name' => '个人信息',
47
            'url' => 'user/edit',
48
        ];
49
    }
50

51
    public function onNavGetTypes(&$types)
52
    {
53
        $types['user'] = [
×
54
            'name' => '个人中心',
55
            'supports' => [
56
                'type',
57
                'icons',
58
                'bg-color',
59
            ],
60
        ];
61
    }
62

63
    /**
64
     * 创建用户后,将用户移到默认分组
65
     *
66
     * @param User $user
67
     */
68
    public function onAsyncUserCreate(User $user)
69
    {
70
        if ($user['groupId']) {
×
71
            return;
×
72
        }
73

74
        $defaultGroupId = wei()->user->defaultGroupId;
×
75
        if ($defaultGroupId) {
×
76
            $user->updateGroup($defaultGroupId);
×
77
        }
78
    }
79
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc