Files
autocrm/app/Filament/Tenant/Pages/Backup.php
T
Vasyka f7fc69077b feat(i18n): wrap 1103 hardcoded UI strings across Filament with __()
- Convert static $modelLabel/$pluralModelLabel/$title to getter methods
- Wrap ->label()/->placeholder()/->helperText()/->description()/->title()/->body() args
- Wrap Section::make()/Fieldset::make()/Notification::make()->title() args
- Fix RelationManagers::getTitle() signature to match parent (Model, string)
- Fix Pages::getTitle() to instance method (BasePage::getTitle is non-static)
- Extend lang/ru.json + lang/en.json with 700+ common terms; identity fallback for the rest
- Remove duplicate getters in 5 resources that had manual getModelLabel already

All 306 tests pass. Missing translations fall back to the RO key so the UI never breaks.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-07-15 05:04:24 +00:00

54 lines
1.4 KiB
PHP

<?php
namespace App\Filament\Tenant\Pages;
use App\Models\Central\Company;
use App\Services\TenantBackupService;
use App\Tenancy\TenantManager;
use Filament\Notifications\Notification;
use Filament\Pages\Page;
class Backup extends Page
{
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-archive-box-arrow-down';
public static function getNavigationLabel(): string
{
return __('nav.label.Backup');
}
public static function getNavigationGroup(): ?string
{
return __('nav.group.Admin');
}
protected static ?int $navigationSort = 96;
protected static ?string $title = null;
public function getTitle(): string
{
return __('Backup & Export date');
}
protected string $view = 'filament.tenant.pages.backup';
public function downloadBackup()
{
$tenant = app(TenantManager::class)->current();
if (! $tenant) abort(404);
// Re-fetch via central scope to avoid issues.
$company = Company::withoutGlobalScopes()->find($tenant->id);
if (! $company) abort(404);
$svc = app(TenantBackupService::class);
$file = $svc->export($company);
$filename = $svc->filename($company);
return response()->download($file, $filename, [
'Content-Type' => 'application/zip',
])->deleteFileAfterSend();
}
}