如何在Laravel中创建双重用户类型?

时间:2019-07-18 14:59:30

标签: php laravel

在ı添加用户时,会自动添加一种userType,因此,我想再添加一种用户类型。

我这样添加了userType:

$startLevel = FortuneTypeLevelRepository::instance()->getFirstLevel(FortuneType::COFFEE);
        UserFortuneTypeRepository::instance()->create([
            'user_id'         => $user->id,
            'fortune_type_id' => $startLevel->fortune_type_id,
            'percentage'      => $startLevel->percentage,
            'price'           => $startLevel->price,
            'credit'          => $startLevel->credit,
            'star'            => $startLevel->star,
            'max_busy'        => $startLevel->max_busy,
            'can_express'     => $startLevel->can_express,
            'express_price'   => $startLevel->price,
            'express_credit'  => $startLevel->credit,
        ]);


        Cache::forget('fortuneTellerList.' . $startLevel->fortune_type_id);

我如何才能复制此用户类型,只能进行如下更改:

$startLevel = FortuneTypeLevelRepository::instance()->getFirstLevel(FortuneType::TAROT);

一种类型COFFE一种类型TAROT,我要在创建用户时添加这两种用户类型?

0 个答案:

没有答案