Add tier feature design spec, annual billing, fuel type normalization, and admin subscription management
- Add comprehensive tier feature matrix spec defining Free/Basic/Plus/Pro capabilities across recommendations, predictions, history, logs, tools, and family sharing - Add `stripe_price_id_annual` column to plans table and rename existing column to `stripe_price_id_monthly` - Normalize legacy fuel type aliases (petrol→e10, diesel→b7_standard) in users table - Implement BillingController with checkout, portal, success/cancel routes supporting monthly/annual cadence - Add admin subscription assignment in Filament user edit page with admin-granted subscription support - Add DowngradeUserOnSubscriptionDeleted listener to disable WhatsApp/SMS preferences on subscription cancellation - Add MissedNotificationsOverview widget to Filament user detail page - Add PollFuelPricesTest covering auto-refresh scenarios - Add PriceReliability enum with reliability classification based on price age - Add fuelTypes.js constants file exporting FUEL_TYPES from window global
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?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
|
||||
{
|
||||
Schema::table('plans', function (Blueprint $table) {
|
||||
$table->renameColumn('stripe_price_id', 'stripe_price_id_monthly');
|
||||
});
|
||||
|
||||
Schema::table('plans', function (Blueprint $table) {
|
||||
$table->string('stripe_price_id_annual')->nullable()->after('stripe_price_id_monthly')
|
||||
->comment('Cashier price ID for annual billing');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('plans', function (Blueprint $table) {
|
||||
$table->dropColumn('stripe_price_id_annual');
|
||||
});
|
||||
|
||||
Schema::table('plans', function (Blueprint $table) {
|
||||
$table->renameColumn('stripe_price_id_monthly', 'stripe_price_id');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
$map = [
|
||||
'petrol' => 'e10',
|
||||
'unleaded' => 'e10',
|
||||
'premium_unleaded' => 'e5',
|
||||
'diesel' => 'b7_standard',
|
||||
'premium_diesel' => 'b7_premium',
|
||||
];
|
||||
|
||||
foreach ($map as $from => $to) {
|
||||
DB::table('users')->where('preferred_fuel_type', $from)->update(['preferred_fuel_type' => $to]);
|
||||
}
|
||||
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('preferred_fuel_type', 20)->default('e10')->change();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->string('preferred_fuel_type', 20)->default('petrol')->change();
|
||||
});
|
||||
|
||||
DB::table('users')->where('preferred_fuel_type', 'e10')->update(['preferred_fuel_type' => 'petrol']);
|
||||
DB::table('users')->where('preferred_fuel_type', 'b7_standard')->update(['preferred_fuel_type' => 'diesel']);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user