fix: ✨ Updated Migration to calculate hourly price from existing products
This commit is contained in:
parent
8f38b9e023
commit
950278c948
|
@ -19,6 +19,14 @@ class AddBillingPeriodToProducts extends Migration
|
|||
});
|
||||
|
||||
DB::statement('UPDATE products SET billing_period="hourly"');
|
||||
|
||||
$products = DB::table('products')->get();
|
||||
foreach ($products as $product) {
|
||||
$price = $product->price;
|
||||
$price = $price / 30 / 24;
|
||||
DB::table('products')->where('id', $product->id)->update(['price' => $price]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue