Fix: Move carrier live-pricing choice onto ShippingMethod.charge_by

Reverts the earlier per-rate pricing_mode column in favor of extending Lunar's existing charge_by field (cart_total/weight) with a third "live" option, gated by a SupportsLivePricing capability check on the driver. Adds a shared ResolvesFixedPricing trait so any carrier driver can fall back to Lunar's normal price-break resolution, matching the vendor ShipBy driver's own charge_by handling instead of introducing a separate mechanism. Also fixes an incorrect Get() path in the admin form that silently hid the new "live" option.
This commit is contained in:
2026-07-19 02:24:10 +03:00
parent 4acabe4185
commit d34e450526
6 changed files with 148 additions and 155 deletions
@@ -1,26 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
$prefix = config('lunar.database.table_prefix');
Schema::table("{$prefix}shipping_rates", function (Blueprint $table) {
$table->string('pricing_mode')->default('live')->after('enabled');
});
}
public function down(): void
{
$prefix = config('lunar.database.table_prefix');
Schema::table("{$prefix}shipping_rates", function (Blueprint $table) {
$table->dropColumn('pricing_mode');
});
}
};