cashier/stripe subscription not adding complete data in DB

376 Views Asked by At

I'm trying to create a subscription with cashier. it was working fine yesterday but now there's a problem and i don't know what changed. the problem is subscription is being created on stripe and correct data is returned but not all data is added in subscriptions table. The problem is in this function.

// 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,
    ]));

You see the above commented dd() shows all data but after create(); it only shows

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

these 4 columns. Now what other thing changed was this was also happening in users table when registering a new user and i solved that with

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

I think it stoped working after this. I tried removing it , also adding it to subscriptions model but nothing works. HEELLLPPPP EDIT: I noticed that this create function is working but just not adding my given values.I did include fillable array and as I said it was working before.

0

There are 0 best solutions below