Refactor SMS and Coupon resources to utilize localization for labels and messages, enhancing internationalization support. Update .env.example to change APP_LOCALE to 'tk'.
This commit is contained in:
@@ -19,12 +19,17 @@ class CouponResource extends Resource
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'phone';
|
||||
|
||||
protected static ?string $navigationLabel = 'Coupons';
|
||||
protected static ?string $navigationLabel = null;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedTicket;
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('filament.coupons.navigation');
|
||||
}
|
||||
|
||||
public static function infolist(Schema $schema): Schema
|
||||
{
|
||||
return CouponInfolist::configure($schema);
|
||||
|
||||
@@ -12,13 +12,17 @@ class CouponInfolist
|
||||
return $schema
|
||||
->components([
|
||||
TextEntry::make('phone')
|
||||
->label(__('filament.fields.phone'))
|
||||
->formatStateUsing(fn (string $state): string => format_phone($state))
|
||||
->copyable(),
|
||||
TextEntry::make('code')
|
||||
->label(__('filament.fields.code'))
|
||||
->copyable(),
|
||||
TextEntry::make('created_at')
|
||||
->label(__('filament.fields.created_at'))
|
||||
->dateTime(),
|
||||
TextEntry::make('updated_at')
|
||||
->label(__('filament.fields.updated_at'))
|
||||
->dateTime(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App\Filament\Resources\Coupons\Tables;
|
||||
|
||||
use App\Filament\Tables\Filters\CreatedAtDateFilter;
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\ViewAction;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
@@ -16,19 +16,24 @@ class CouponsTable
|
||||
->defaultSort('created_at', 'desc')
|
||||
->columns([
|
||||
TextColumn::make('id')
|
||||
->label(__('filament.fields.id'))
|
||||
->sortable(),
|
||||
TextColumn::make('phone')
|
||||
->label(__('filament.fields.phone'))
|
||||
->formatStateUsing(fn (string $state): string => format_phone($state))
|
||||
->searchable()
|
||||
->sortable()
|
||||
->copyable(),
|
||||
TextColumn::make('code')
|
||||
->label(__('filament.fields.code'))
|
||||
->sortable()
|
||||
->copyable(),
|
||||
TextColumn::make('created_at')
|
||||
->label(__('filament.fields.created_at'))
|
||||
->dateTime()
|
||||
->sortable(),
|
||||
TextColumn::make('updated_at')
|
||||
->label(__('filament.fields.updated_at'))
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
|
||||
@@ -19,16 +19,31 @@ class PhoneVerificationResource extends Resource
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'phone';
|
||||
|
||||
protected static ?string $navigationLabel = 'OTP Verifications';
|
||||
protected static ?string $navigationLabel = null;
|
||||
|
||||
protected static ?string $modelLabel = 'OTP verification';
|
||||
protected static ?string $modelLabel = null;
|
||||
|
||||
protected static ?string $pluralModelLabel = 'OTP verifications';
|
||||
protected static ?string $pluralModelLabel = null;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedKey;
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('filament.phone_verifications.navigation');
|
||||
}
|
||||
|
||||
public static function getModelLabel(): string
|
||||
{
|
||||
return __('filament.phone_verifications.model');
|
||||
}
|
||||
|
||||
public static function getPluralModelLabel(): string
|
||||
{
|
||||
return __('filament.phone_verifications.plural');
|
||||
}
|
||||
|
||||
public static function infolist(Schema $schema): Schema
|
||||
{
|
||||
return PhoneVerificationInfolist::configure($schema);
|
||||
|
||||
@@ -13,15 +13,20 @@ class PhoneVerificationInfolist
|
||||
return $schema
|
||||
->components([
|
||||
TextEntry::make('phone')
|
||||
->label(__('filament.fields.phone'))
|
||||
->formatStateUsing(fn (string $state): string => format_phone($state))
|
||||
->copyable(),
|
||||
TextEntry::make('expires_at')
|
||||
->label(__('filament.fields.expires_at'))
|
||||
->dateTime(),
|
||||
IconEntry::make('verified')
|
||||
->label(__('filament.fields.verified'))
|
||||
->boolean(),
|
||||
TextEntry::make('created_at')
|
||||
->label(__('filament.fields.created_at'))
|
||||
->dateTime(),
|
||||
TextEntry::make('updated_at')
|
||||
->label(__('filament.fields.updated_at'))
|
||||
->dateTime(),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -16,22 +16,28 @@ class PhoneVerificationsTable
|
||||
->defaultSort('created_at', 'desc')
|
||||
->columns([
|
||||
TextColumn::make('id')
|
||||
->label(__('filament.fields.id'))
|
||||
->sortable(),
|
||||
TextColumn::make('phone')
|
||||
->label(__('filament.fields.phone'))
|
||||
->formatStateUsing(fn (string $state): string => format_phone($state))
|
||||
->searchable()
|
||||
->sortable()
|
||||
->copyable(),
|
||||
TextColumn::make('expires_at')
|
||||
->label(__('filament.fields.expires_at'))
|
||||
->dateTime()
|
||||
->sortable(),
|
||||
IconColumn::make('verified')
|
||||
->label(__('filament.fields.verified'))
|
||||
->boolean()
|
||||
->sortable(),
|
||||
TextColumn::make('created_at')
|
||||
->label(__('filament.fields.created_at'))
|
||||
->dateTime()
|
||||
->sortable(),
|
||||
TextColumn::make('updated_at')
|
||||
->label(__('filament.fields.updated_at'))
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
|
||||
Reference in New Issue
Block a user