chore: code styling via pint
This commit is contained in:
@@ -2,35 +2,39 @@
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Filament\Actions\BulkAction;
|
||||
use App\Models\ActivationKey;
|
||||
use App\Models\Plan;
|
||||
use Filament\Actions\BulkAction;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Concerns\InteractsWithForms;
|
||||
use Filament\Forms\Contracts\HasForms;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Pages\Page;
|
||||
use Filament\Tables\Columns\BooleanColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Concerns\InteractsWithTable;
|
||||
use Filament\Tables\Contracts\HasTable;
|
||||
use Filament\Tables\Filters\SelectFilter;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Collection;
|
||||
use Response;
|
||||
use Str;
|
||||
use Filament\Notifications\Notification;
|
||||
|
||||
class GenerateActivationKeys extends Page implements HasForms, HasTable
|
||||
{
|
||||
use InteractsWithForms, InteractsWithTable;
|
||||
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-key';
|
||||
protected static string|\BackedEnum|null $navigationIcon = 'heroicon-o-key';
|
||||
|
||||
protected string $view = 'filament.pages.generate-activation-keys';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Admin';
|
||||
|
||||
protected static string|\UnitEnum|null $navigationGroup = 'Admin';
|
||||
|
||||
protected static ?string $title = 'Activation Keys';
|
||||
|
||||
public $plan_id;
|
||||
|
||||
public $quantity = 1;
|
||||
|
||||
public function mount(): void
|
||||
@@ -97,10 +101,10 @@ class GenerateActivationKeys extends Page implements HasForms, HasTable
|
||||
->label('Interval')
|
||||
->getStateUsing(function ($record) {
|
||||
$isMonthly = Plan::where('pricing_id', $record->price_id)->value('monthly_billing');
|
||||
|
||||
return $isMonthly ? 'Monthly' : 'Yearly';
|
||||
}),
|
||||
|
||||
|
||||
TextColumn::make('created_at')
|
||||
->dateTime(),
|
||||
];
|
||||
@@ -136,12 +140,12 @@ class GenerateActivationKeys extends Page implements HasForms, HasTable
|
||||
{
|
||||
$text = $records->pluck('activation_key')->implode("\n");
|
||||
|
||||
$filename = 'activation_keys_' . now()->timestamp . '.txt';
|
||||
$filename = 'activation_keys_'.now()->timestamp.'.txt';
|
||||
// Store the file in the 'public' directory or a subdirectory within 'public'
|
||||
$path = public_path("activation/{$filename}");
|
||||
|
||||
// Make sure the 'activation' folder exists, create it if it doesn't
|
||||
if (!file_exists(public_path('activation'))) {
|
||||
if (! file_exists(public_path('activation'))) {
|
||||
mkdir(public_path('activation'), 0777, true);
|
||||
}
|
||||
|
||||
@@ -151,5 +155,4 @@ class GenerateActivationKeys extends Page implements HasForms, HasTable
|
||||
// Return the response that allows users to download the file directly
|
||||
return response()->download($path)->deleteFileAfterSend(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user