Laravel Cashier is not saving stripe data to my DB after a user is created.
When I create a new user and then try to assign a subscription() to that user (or any other user for that matter) the data is being sent to Stripe approriately, as I can see the customer id, plan chosen, etc... But my database user stripe columns do not get updated in my database.
When I remove the code to create() a user and just subscribe a user, the data persists to the database like it should. It only doesn't work after I've created a new user THEN try to subscribe any user.
I'm using Jeffrey Way's Model Validation Package.
$user = $this->userModel->create($input);
if ($user->hasErrors()) {
throw new \Exception($user->getErrors());
}
$this->createStripeSubscription($user->id, $input['creditCardToken']);
private function createStripeSubscription($user_id, $token) {
//$this->userModel->find(1)->subscription('monthly')->create($token); // Doesn't work either
$this->userModel->find($user_id)->subscription('monthly')->create($token);
}
The problem was a conflict with Jeffrey Way's Validation Model package. Or at least the way I was trying to implement it while using Cashier. I decided to abstract out my Validation in it's own class and remove the Validation Model package. All is good.