mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 03:57:22 +08:00
Merge remote-tracking branch 'origin/php8' into php8
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TorrentCustomFields\Pages;
|
||||
|
||||
use App\Filament\Resources\TorrentCustomFields\TorrentCustomFieldResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListTorrentCustomFields extends ListRecords
|
||||
{
|
||||
protected static string $resource = TorrentCustomFieldResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TorrentCustomFields\Schemas;
|
||||
|
||||
use Filament\Forms\Components\Checkbox;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\Textarea;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Schemas\Schema;
|
||||
use Nexus\Field\Field;
|
||||
|
||||
class TorrentCustomFieldForm
|
||||
{
|
||||
public static function configure(Schema $schema): Schema
|
||||
{
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->label(__('label.field.name'))
|
||||
->helperText(__('label.field.name_help'))
|
||||
->alphaDash()
|
||||
->required(),
|
||||
TextInput::make('label')
|
||||
->label(__('label.field.field_label'))
|
||||
->required(),
|
||||
Select::make('type')
|
||||
->options((new Field())->getTypeRadioOptions())
|
||||
->label(__('label.field.type'))
|
||||
->required(),
|
||||
Checkbox::make('required')
|
||||
->label(__('label.field.required')),
|
||||
Textarea::make('help')
|
||||
->label(__('label.field.help'))
|
||||
->rows(3),
|
||||
Textarea::make('options')
|
||||
->label(__('label.field.options'))
|
||||
->rows(3)
|
||||
->hiddenJs("\$get('type') !== 'radio' && \$get('type') !== 'checkbox' && \$get('type') !== 'select'")
|
||||
->helperText(__('label.field.options_help')),
|
||||
Checkbox::make('is_single_row')
|
||||
->label(__('label.field.is_single_row')),
|
||||
TextInput::make('priority')
|
||||
->label(__('label.priority'))
|
||||
->numeric(),
|
||||
Textarea::make('display')
|
||||
->label(__('label.field.display'))
|
||||
->rows(3)
|
||||
->helperText(__('label.search_box.custom_fields_display_help')),
|
||||
|
||||
])
|
||||
->columns(1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TorrentCustomFields\Tables;
|
||||
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Table;
|
||||
|
||||
class TorrentCustomFieldsTable
|
||||
{
|
||||
public static function configure(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
TextColumn::make('id'),
|
||||
TextColumn::make('name')->label(__('label.field.name')),
|
||||
TextColumn::make('label')->label(__('label.field.field_label')),
|
||||
TextColumn::make('type')->label(__('label.field.type')),
|
||||
IconColumn::make('required')->boolean()->label(__('label.field.required')),
|
||||
IconColumn::make('is_single_row')->boolean()->label(__('label.field.is_single_row')),
|
||||
TextColumn::make('priority')->label(__('label.priority')),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\TorrentCustomFields;
|
||||
|
||||
use App\Filament\Resources\TorrentCustomFields\Pages\ListTorrentCustomFields;
|
||||
use App\Filament\Resources\TorrentCustomFields\Schemas\TorrentCustomFieldForm;
|
||||
use App\Filament\Resources\TorrentCustomFields\Tables\TorrentCustomFieldsTable;
|
||||
use App\Models\TorrentCustomField;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
use UnitEnum;
|
||||
|
||||
class TorrentCustomFieldResource extends Resource
|
||||
{
|
||||
protected static ?string $model = TorrentCustomField::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
|
||||
|
||||
protected static string|null|UnitEnum $navigationGroup = 'Section';
|
||||
|
||||
protected static ?int $navigationSort = 12;
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('label.field.label');
|
||||
}
|
||||
|
||||
public static function getBreadcrumb(): string
|
||||
{
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return TorrentCustomFieldForm::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return TorrentCustomFieldsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListTorrentCustomFields::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\User;
|
||||
|
||||
use App\Filament\Resources\User\UserPasskeyResource\Pages;
|
||||
use App\Models\Passkey;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class UserPasskeyResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Passkey::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-key';
|
||||
|
||||
protected static ?string $navigationGroup = 'User';
|
||||
|
||||
protected static ?int $navigationSort = 12;
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('passkey.passkey');
|
||||
}
|
||||
|
||||
public static function getBreadcrumb(): string
|
||||
{
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
//
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')->sortable()
|
||||
,
|
||||
Tables\Columns\TextColumn::make('user_id')
|
||||
->formatStateUsing(fn($state) => username_for_admin($state))
|
||||
->label(__('label.username'))
|
||||
,
|
||||
Tables\Columns\TextColumn::make('AAGUID')
|
||||
->label("AAGUID")
|
||||
,
|
||||
Tables\Columns\TextColumn::make('credential_id')
|
||||
->label(__('passkey.fields.credential_id'))
|
||||
,
|
||||
Tables\Columns\TextColumn::make('counter')
|
||||
->label(__('passkey.fields.counter'))
|
||||
,
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label(__('label.created_at'))
|
||||
,
|
||||
])
|
||||
->defaultSort('id', 'desc')
|
||||
->filters([
|
||||
Tables\Filters\Filter::make('user_id')
|
||||
->form([
|
||||
Forms\Components\TextInput::make('uid')
|
||||
->label(__('label.username'))
|
||||
->placeholder('UID')
|
||||
,
|
||||
])->query(function (Builder $query, array $data) {
|
||||
return $query->when($data['uid'], fn(Builder $query, $value) => $query->where("user_id", $value));
|
||||
})
|
||||
,
|
||||
Tables\Filters\Filter::make('credential_id')
|
||||
->form([
|
||||
Forms\Components\TextInput::make('credential_id')
|
||||
->label(__('passkey.fields.credential_id'))
|
||||
->placeholder('Credential ID')
|
||||
,
|
||||
])->query(function (Builder $query, array $data) {
|
||||
return $query->when($data['credential_id'], fn(Builder $query, $value) => $query->where("credential_id", $value));
|
||||
})
|
||||
,
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ManageUserPasskey::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\User\UserPasskeyResource\Pages;
|
||||
|
||||
use App\Filament\PageListSingle;
|
||||
use App\Filament\Resources\User\UserPasskeyResource;
|
||||
|
||||
class ManageUserPasskey extends PageListSingle
|
||||
{
|
||||
protected static string $resource = UserPasskeyResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user