1

我正在尝试使用收银员创建订阅。它昨天工作正常,但现在出现问题,我不知道发生了什么变化。问题是在条带上创建订阅并返回正确的数据,但并非所有数据都添加到订阅表中。问题出在这个函数上。

// dd($this->name,$subscription->id,$this->plan,$this->quantity,$trialEndsAt);
    dd('builder',$this->owner->subscriptions()->create([
        'name' => $this->name,
        'stripe_id' => $subscription->id,
        'stripe_plan' => $this->plan,
        'quantity' => $this->quantity,
        'trial_ends_at' => $trialEndsAt,
        'ends_at' => null,
    ]));

您会看到上面的注释dd()显示了所有数据,但在 create(); 之后 它只显示

    #attributes: array:4 [▼
      "user_id" => 18
      "updated_at" => "2020-12-19 12:24:04"
      "created_at" => "2020-12-19 12:24:04"
      "id" => 46
    ]

这 4 列。现在其他的变化是在注册新用户时这也发生在用户表中,我解决了这个问题

    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);
    }

我认为它在此之后停止工作。我尝试将其删除,并将其添加到订阅模型中,但没有任何效果。HEELLLPPPP 编辑:我注意到这个创建函数正在工作,但只是没有添加我给定的值。我确实包含了可填充数组,正如我之前所说的那样它可以工作。

4

0 回答 0