Skip to content

Commit 6cee13e

Browse files
authored
Add the ability to choose the currency symbol (#280)
* Add the ability to choose the currency symbol * Update wave/database/migrations/2025_10_14_143501_add_currency_column.php * Plan currency with 3 characters max * List 4 currency symbols when editing a plan
1 parent 997d8fc commit 6cee13e

File tree

4 files changed

+40
-2
lines changed

4 files changed

+40
-2
lines changed

app/Filament/Resources/Plans/PlanResource.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,14 @@ public static function form(Schema $schema): Schema
7979
->maxLength(191),
8080
TextInput::make('onetime_price')
8181
->maxLength(191),
82+
Select::make('currency')
83+
->default('$')
84+
->options([
85+
'$' => '$',
86+
'' => '',
87+
'£' => '£',
88+
'¥' => '¥',
89+
]),
8290
])->columns(2),
8391
Section::make('Plan Status')
8492
->description('Make the plan default or active/inactive and set the sort order')
@@ -130,6 +138,8 @@ public static function table(Table $table): Table
130138
->sortable(),
131139
BooleanColumn::make('active')
132140
->sortable(),
141+
TextColumn::make('currency')
142+
->toggleable(isToggledHiddenByDefault: true),
133143
TextColumn::make('created_at')
134144
->dateTime()
135145
->sortable()

resources/themes/anchor/components/marketing/sections/pricing.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class="flex-1 px-0 mx-auto mb-6 w-full md:max-w-lg lg:mb-0" x-cloak>
5959
</div>
6060

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

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::table('plans', function (Blueprint $table) {
15+
$table->string('currency', 3)->default('$');
16+
});
17+
}
18+
19+
/**
20+
* Reverse the migrations.
21+
*/
22+
public function down(): void
23+
{
24+
Schema::table('plans', function (Blueprint $table) {
25+
$table->dropColumn('currency');
26+
});
27+
}
28+
};

wave/resources/views/livewire/billing/checkout.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class="w-full max-w-full px-0 mx-auto group">
3939

4040
<div class="my-3 space-y-2 md:my-5">
4141
<div class="relative">
42-
<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>
42+
<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>
4343
<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>
4444
</div>
4545
<p class="text-sm leading-7 text-gray-500 dark:text-neutral-300 lg:text-base">{{ $plan->description }}</p>

0 commit comments

Comments
 (0)