Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/Filament/Resources/Plans/PlanResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public static function form(Schema $schema): Schema
->maxLength(191),
TextInput::make('onetime_price')
->maxLength(191),
TextInput::make('currency')
->maxLength(191),
Copy link

Copilot AI Oct 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The currency field should have input validation to ensure only valid currency symbols are entered. Consider adding a validation rule or using a Select component with predefined currency options.

Suggested change
TextInput::make('currency')
->maxLength(191),
Select::make('currency')
->options([
'USD' => 'USD',
'EUR' => 'EUR',
'GBP' => 'GBP',
'AUD' => 'AUD',
'CAD' => 'CAD',
'JPY' => 'JPY',
'CHF' => 'CHF',
'CNY' => 'CNY',
'INR' => 'INR',
// Add more as needed
])
->searchable()
->required(),

Copilot uses AI. Check for mistakes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bobbyiliev, it could be a good idea to have a currency list but with symbols not the 3 letters codes.

Before I do this PR, I see Laravel libs that has all the world currency symbols but it seems to be too much imo (100+ currencies).
To keep it simple, I can just add a few symbols like $, , £ and ¥. What do you think?

I can also, may be, reduce the size of the column to 1 character (or 3 if we put the code later). What do you think?

])->columns(2),
Section::make('Plan Status')
->description('Make the plan default or active/inactive')
Expand Down Expand Up @@ -113,6 +115,8 @@ public static function table(Table $table): Table
->sortable(),
BooleanColumn::make('active')
->sortable(),
TextColumn::make('currency')
->toggleable(isToggledHiddenByDefault: true),
TextColumn::make('created_at')
->dateTime()
->sortable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class="flex-1 px-0 mx-auto mb-6 w-full md:max-w-lg lg:mb-0" x-cloak>
</div>

<div class="px-8 mt-5">
<span class="text-5xl font-bold">$<span x-text="billing == 'Monthly' ? '{{ $plan->monthly_price }}' : '{{ $plan->yearly_price }}'"></span></span>
<span class="text-5xl font-bold">{{ $plan->currency }}<span x-text="billing == 'Monthly' ? '{{ $plan->monthly_price }}' : '{{ $plan->yearly_price }}'"></span></span>
<span class="text-xl font-bold text-zinc-500"><span x-text="billing == 'Monthly' ? '/mo' : '/yr'"></span></span>
</div>

Expand Down
28 changes: 28 additions & 0 deletions wave/database/migrations/2025_10_14_143501_add_currency_column.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('plans', function (Blueprint $table) {
$table->string('currency')->default('$');
});
}

/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('plans', function (Blueprint $table) {
Schema::dropColumns('plans', 'currency');
});
}
};
2 changes: 1 addition & 1 deletion wave/resources/views/livewire/billing/checkout.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class="w-full max-w-full px-0 mx-auto group">

<div class="my-3 space-y-2 md:my-5">
<div class="relative">
<span class="text-3xl font-bold lg:text-4xl dark:text-neutral-200">$<span x-text="billing_cycle_selected == 'month' ? '{{ $plan->monthly_price }}' : '{{ $plan->yearly_price }}'"></span></span>
<span class="text-3xl font-bold lg:text-4xl dark:text-neutral-200">{{ $plan->currency }}<span x-text="billing_cycle_selected == 'month' ? '{{ $plan->monthly_price }}' : '{{ $plan->yearly_price }}'"></span></span>
<span class="inline-block text-xl font-bold text-gray-500 dark:text-neutral-200 -translate-y-0.5 lg:text-2xl"><span x-text="billing_cycle_selected == 'month' ? '/mo' : '/yr'"></span></span>
</div>
<p class="text-sm leading-7 text-gray-500 dark:text-neutral-300 lg:text-base">{{ $plan->description }}</p>
Expand Down