问题描述
我正在尝试使用收银员创建订阅。昨天工作正常,但现在出现问题,我不知道发生了什么变化。问题是正在条带上创建订阅并返回正确的数据,但并非所有数据都添加到订阅表中。问题出在这个函数上。
// 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 编辑:我注意到这个创建函数正在工作,但只是没有添加我给定的值。我确实包含了可填充数组,正如我之前所说的那样。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)