Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

geerizzle's avatar

DB Update works on local, but not production?!!

This is driving me bonkers. See this insert:

$subscription = new Subscription([ 
    'user_id' => \Auth::user()->id,  
    'stripe_id' => $cart->stripe_sub_id,  
    'stripe_plan' => $panel->chosen_plan, 
    'last_order_id' => $order->id,  
    'latest_order_created' => true, 
    'price' =>  $panel->chosen_price,  
    'interval' => $cart->interval, 
    'next_billed' => \Carbon\Carbon::now()->addMonths($cart->interval)
]);

Everything works except this bit: 'latest_order_created' =>true which I have also tried as 'latest_order_created' => 1

It works on local, but on production it is always false, I cannot understand it?!

Migrations have been run, the field exists in DB, it's enabled as fillable and boolean in the model, and I've cleared the cache, config etc just to be sure.

What am I missing I am sure it must be something simple!

0 likes
6 replies
Nakov's avatar

Since you are doing a mass assignment, have you checked in your Subscription model if you have that item listed in the $fillable array.

Not sure how that would work locally and not on production, but just to be sure.

And also make sure you use the same database as on production, the driver too.

geerizzle's avatar

Yes it's in the fillable array, and both DBs are using mysql. Everything else is working fine, I have been running and developing this app for 18 months!

Snapey's avatar

What is the column type in both places?

geerizzle's avatar

Hi it was created using this migration:

$table->boolean('latest_order_created')->after('last_order_id')->default(true);

And then phpmyadmin shows it as a tinyint(1), default of 1, in both locations.

geerizzle's avatar

Thanks, actually I just worked it out. On production Stripe sends a webhook which then immediately turns this back to false, doh.

1 like

Please or to participate in this conversation.