mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
migration script
# Conflicts: # app/Filament/Resources/Torrent/AnnounceLogResource.php
This commit is contained in:
@@ -2,11 +2,15 @@
|
||||
|
||||
namespace App\Filament\Resources\Oauth;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use App\Filament\Resources\Oauth\AccessTokenResource\Pages\ManageAccessTokens;
|
||||
use App\Filament\Resources\Oauth\AccessTokenResource\Pages;
|
||||
use App\Filament\Resources\Oauth\AccessTokenResource\RelationManagers;
|
||||
use Laravel\Passport\Token;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables;
|
||||
@@ -17,9 +21,9 @@ class AccessTokenResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Token::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Oauth';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Oauth';
|
||||
|
||||
protected static ?int $navigationSort = 3;
|
||||
|
||||
@@ -33,10 +37,10 @@ class AccessTokenResource extends Resource
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
return $schema
|
||||
->components([
|
||||
//
|
||||
]);
|
||||
}
|
||||
@@ -45,32 +49,32 @@ class AccessTokenResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')->searchable(),
|
||||
Tables\Columns\TextColumn::make('user.username')
|
||||
TextColumn::make('id')->searchable(),
|
||||
TextColumn::make('user.username')
|
||||
->label(__('label.username'))
|
||||
->formatStateUsing(fn ($record) => username_for_admin($record->user_id)),
|
||||
Tables\Columns\TextColumn::make('client.name')
|
||||
TextColumn::make('client.name')
|
||||
->label(__('oauth.client')),
|
||||
Tables\Columns\TextColumn::make('expires_at')
|
||||
TextColumn::make('expires_at')
|
||||
->label(__('label.expire_at'))
|
||||
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
->recordActions([
|
||||
// Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ManageAccessTokens::route('/'),
|
||||
'index' => ManageAccessTokens::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,15 @@
|
||||
|
||||
namespace App\Filament\Resources\Oauth;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use App\Filament\Resources\Oauth\AuthCodeResource\Pages\ManageAuthCodes;
|
||||
use App\Filament\Resources\Oauth\AuthCodeResource\Pages;
|
||||
use App\Filament\Resources\Oauth\AuthCodeResource\RelationManagers;
|
||||
use Laravel\Passport\AuthCode;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables;
|
||||
@@ -17,9 +21,9 @@ class AuthCodeResource extends Resource
|
||||
{
|
||||
protected static ?string $model = AuthCode::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Oauth';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Oauth';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
@@ -33,10 +37,10 @@ class AuthCodeResource extends Resource
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
return $schema
|
||||
->components([
|
||||
//
|
||||
]);
|
||||
}
|
||||
@@ -45,31 +49,31 @@ class AuthCodeResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id'),
|
||||
Tables\Columns\TextColumn::make('user_id')
|
||||
TextColumn::make('id'),
|
||||
TextColumn::make('user_id')
|
||||
->label(__('label.username'))
|
||||
->formatStateUsing(fn ($record) => username_for_admin($record->user_id)),
|
||||
Tables\Columns\TextColumn::make('client.name')
|
||||
TextColumn::make('client.name')
|
||||
->label(__('oauth.client')),
|
||||
Tables\Columns\TextColumn::make('expires_at')
|
||||
TextColumn::make('expires_at')
|
||||
->label(__('label.expire_at'))
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
->recordActions([
|
||||
// Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ManageAuthCodes::route('/'),
|
||||
'index' => ManageAuthCodes::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,13 +2,21 @@
|
||||
|
||||
namespace App\Filament\Resources\Oauth;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Radio;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use App\Filament\Resources\Oauth\ClientResource\Pages\ManageClients;
|
||||
use App\Filament\OptionsTrait;
|
||||
use App\Filament\PageListSingle;
|
||||
use App\Filament\Resources\Oauth\ClientResource\Pages;
|
||||
use App\Filament\Resources\Oauth\ClientResource\RelationManagers;
|
||||
use App\Models\OauthClient;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables;
|
||||
@@ -21,9 +29,9 @@ class ClientResource extends Resource
|
||||
|
||||
protected static ?string $model = OauthClient::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Oauth';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Oauth';
|
||||
|
||||
protected static ?int $navigationSort = 1;
|
||||
|
||||
@@ -37,13 +45,13 @@ class ClientResource extends Resource
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')->label(__('label.name'))->required(),
|
||||
Forms\Components\TextInput::make('redirect')->label(__('oauth.redirect'))->required(),
|
||||
Forms\Components\Radio::make('skips_authorization')
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')->label(__('label.name'))->required(),
|
||||
TextInput::make('redirect')->label(__('oauth.redirect'))->required(),
|
||||
Radio::make('skips_authorization')
|
||||
->options(self::getYesNoOptions())
|
||||
->inline()
|
||||
->default(0)
|
||||
@@ -56,11 +64,11 @@ class ClientResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id'),
|
||||
Tables\Columns\TextColumn::make('name')->label(__('label.name')),
|
||||
Tables\Columns\TextColumn::make('secret')->label(__('oauth.secret')),
|
||||
Tables\Columns\TextColumn::make('redirect')->label(__('oauth.redirect')),
|
||||
Tables\Columns\IconColumn::make('skips_authorization')
|
||||
TextColumn::make('id'),
|
||||
TextColumn::make('name')->label(__('label.name')),
|
||||
TextColumn::make('secret')->label(__('oauth.secret')),
|
||||
TextColumn::make('redirect')->label(__('oauth.redirect')),
|
||||
IconColumn::make('skips_authorization')
|
||||
->boolean()
|
||||
->label(__('oauth.skips_authorization'))
|
||||
,
|
||||
@@ -69,19 +77,19 @@ class ClientResource extends Resource
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ManageClients::route('/'),
|
||||
'index' => ManageClients::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\Oauth\ClientResource\Pages;
|
||||
|
||||
use Filament\Actions\CreateAction;
|
||||
use App\Filament\PageListSingle;
|
||||
use App\Filament\Resources\Oauth\ClientResource;
|
||||
use Filament\Pages\Actions;
|
||||
@@ -14,7 +15,7 @@ class ManageClients extends PageListSingle
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,21 @@
|
||||
|
||||
namespace App\Filament\Resources\Oauth;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Tables\Columns\IconColumn;
|
||||
use Filament\Actions\EditAction;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\BulkActionGroup;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use App\Filament\Resources\Oauth\ProviderResource\Pages\ManageProviders;
|
||||
use App\Filament\Resources\Oauth\ProviderResource\Pages;
|
||||
use App\Filament\Resources\Oauth\ProviderResource\RelationManagers;
|
||||
use App\Models\OauthProvider;
|
||||
use App\Models\User;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
@@ -20,9 +29,9 @@ class ProviderResource extends Resource
|
||||
{
|
||||
protected static ?string $model = OauthProvider::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Oauth';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Oauth';
|
||||
|
||||
protected static ?int $navigationSort = 5;
|
||||
|
||||
@@ -36,64 +45,64 @@ class ProviderResource extends Resource
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\TextInput::make('name')
|
||||
return $schema
|
||||
->components([
|
||||
TextInput::make('name')
|
||||
->label(__('label.name'))
|
||||
->required()
|
||||
,
|
||||
Forms\Components\TextInput::make('client_id')
|
||||
TextInput::make('client_id')
|
||||
->label(__('oauth.client_id'))
|
||||
->required()
|
||||
,
|
||||
Forms\Components\TextInput::make('client_secret')
|
||||
TextInput::make('client_secret')
|
||||
->label(__('oauth.secret'))
|
||||
->required()
|
||||
,
|
||||
Forms\Components\TextInput::make('authorization_endpoint_url')
|
||||
TextInput::make('authorization_endpoint_url')
|
||||
->label(__('oauth.authorization_endpoint_url'))
|
||||
->required()
|
||||
,
|
||||
Forms\Components\TextInput::make('token_endpoint_url')
|
||||
TextInput::make('token_endpoint_url')
|
||||
->label(__('oauth.token_endpoint_url'))
|
||||
->required()
|
||||
,
|
||||
Forms\Components\TextInput::make('user_info_endpoint_url')
|
||||
TextInput::make('user_info_endpoint_url')
|
||||
->label(__('oauth.user_info_endpoint_url'))
|
||||
->required()
|
||||
,
|
||||
Forms\Components\TextInput::make('id_claim')
|
||||
TextInput::make('id_claim')
|
||||
->label(__('oauth.id_claim'))
|
||||
->required()
|
||||
,
|
||||
Forms\Components\TextInput::make('email_claim')
|
||||
TextInput::make('email_claim')
|
||||
->label(__('oauth.email_claim'))
|
||||
->required()
|
||||
,
|
||||
Forms\Components\TextInput::make('username_claim')
|
||||
TextInput::make('username_claim')
|
||||
->label(__('oauth.username_claim'))
|
||||
,
|
||||
|
||||
Forms\Components\TextInput::make('level_claim')
|
||||
TextInput::make('level_claim')
|
||||
->label(__('oauth.level_claim'))
|
||||
,
|
||||
Forms\Components\TextInput::make('level_limit')
|
||||
TextInput::make('level_limit')
|
||||
->numeric()
|
||||
->label(__('oauth.level_limit'))
|
||||
->helperText(__('oauth.level_limit_help'))
|
||||
,
|
||||
Forms\Components\TextInput::make('priority')
|
||||
TextInput::make('priority')
|
||||
->label(__('label.priority'))
|
||||
->default(0)
|
||||
->numeric()
|
||||
->helperText(__('label.priority_help'))
|
||||
,
|
||||
Forms\Components\Toggle::make('enabled')
|
||||
Toggle::make('enabled')
|
||||
->label(__('label.enabled'))
|
||||
,
|
||||
Forms\Components\TextInput::make('redirect')
|
||||
TextInput::make('redirect')
|
||||
->default(fn ($record) => OauthProvider::getCallbackUrl($record->uuid ?? self::getNewUuid()))
|
||||
->disabled()
|
||||
->label(__('oauth.redirect'))
|
||||
@@ -113,31 +122,31 @@ class ProviderResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id'),
|
||||
Tables\Columns\TextColumn::make('name')->label(__('label.name')),
|
||||
Tables\Columns\TextColumn::make('client_id')->label(__('oauth.client_id')),
|
||||
Tables\Columns\TextColumn::make('client_secret')->label(__('oauth.secret')),
|
||||
Tables\Columns\TextColumn::make('authorization_endpoint_url')->label(__('oauth.authorization_endpoint_url')),
|
||||
Tables\Columns\TextColumn::make('uuid')
|
||||
TextColumn::make('id'),
|
||||
TextColumn::make('name')->label(__('label.name')),
|
||||
TextColumn::make('client_id')->label(__('oauth.client_id')),
|
||||
TextColumn::make('client_secret')->label(__('oauth.secret')),
|
||||
TextColumn::make('authorization_endpoint_url')->label(__('oauth.authorization_endpoint_url')),
|
||||
TextColumn::make('uuid')
|
||||
->label(__('oauth.redirect'))
|
||||
->formatStateUsing(fn ($state) => url("/oauth/callback/$state"))
|
||||
,
|
||||
Tables\Columns\TextColumn::make('priority')->label(__('label.priority')),
|
||||
Tables\Columns\TextColumn::make('updated_at')->label(__('label.updated_at')),
|
||||
Tables\Columns\TextColumn::make('level_limit')->label(__('oauth.level_limit')),
|
||||
Tables\Columns\IconColumn::make('enabled')->boolean()->label(__('label.enabled')),
|
||||
TextColumn::make('priority')->label(__('label.priority')),
|
||||
TextColumn::make('updated_at')->label(__('label.updated_at')),
|
||||
TextColumn::make('level_limit')->label(__('oauth.level_limit')),
|
||||
IconColumn::make('enabled')->boolean()->label(__('label.enabled')),
|
||||
])
|
||||
->defaultSort('priority', 'desc')
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
->recordActions([
|
||||
EditAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
BulkActionGroup::make([
|
||||
DeleteBulkAction::make(),
|
||||
]),
|
||||
]);
|
||||
}
|
||||
@@ -145,7 +154,7 @@ class ProviderResource extends Resource
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ManageProviders::route('/'),
|
||||
'index' => ManageProviders::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Resources\Oauth\ProviderResource\Pages;
|
||||
|
||||
use Filament\Actions\CreateAction;
|
||||
use App\Filament\PageListSingle;
|
||||
use App\Filament\Resources\Oauth\ProviderResource;
|
||||
use Filament\Actions;
|
||||
@@ -14,7 +15,7 @@ class ManageProviders extends PageListSingle
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,15 @@
|
||||
|
||||
namespace App\Filament\Resources\Oauth;
|
||||
|
||||
use Filament\Schemas\Schema;
|
||||
use Filament\Tables\Columns\TextColumn;
|
||||
use Filament\Actions\DeleteAction;
|
||||
use Filament\Actions\DeleteBulkAction;
|
||||
use App\Filament\Resources\Oauth\RefreshTokenResource\Pages\ManageRefreshTokens;
|
||||
use App\Filament\Resources\Oauth\RefreshTokenResource\Pages;
|
||||
use App\Filament\Resources\Oauth\RefreshTokenResource\RelationManagers;
|
||||
use Laravel\Passport\RefreshToken;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables\Table;
|
||||
use Filament\Tables;
|
||||
@@ -17,9 +21,9 @@ class RefreshTokenResource extends Resource
|
||||
{
|
||||
protected static ?string $model = RefreshToken::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Oauth';
|
||||
protected static string | \UnitEnum | null $navigationGroup = 'Oauth';
|
||||
|
||||
protected static ?int $navigationSort = 4;
|
||||
|
||||
@@ -33,10 +37,10 @@ class RefreshTokenResource extends Resource
|
||||
return self::getNavigationLabel();
|
||||
}
|
||||
|
||||
public static function form(Form $form): Form
|
||||
public static function form(Schema $schema): Schema
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
return $schema
|
||||
->components([
|
||||
//
|
||||
]);
|
||||
}
|
||||
@@ -45,33 +49,33 @@ class RefreshTokenResource extends Resource
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('id')
|
||||
TextColumn::make('id')
|
||||
->label(__('oauth.refresh_token'))
|
||||
->searchable()
|
||||
,
|
||||
Tables\Columns\TextColumn::make('access_token_id')
|
||||
TextColumn::make('access_token_id')
|
||||
->label(__('oauth.access_token'))
|
||||
->searchable()
|
||||
,
|
||||
Tables\Columns\TextColumn::make('expires_at')
|
||||
TextColumn::make('expires_at')
|
||||
->label(__('label.expire_at'))
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->actions([
|
||||
->recordActions([
|
||||
// Tables\Actions\EditAction::make(),
|
||||
Tables\Actions\DeleteAction::make(),
|
||||
DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
->toolbarActions([
|
||||
DeleteBulkAction::make(),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ManageRefreshTokens::route('/'),
|
||||
'index' => ManageRefreshTokens::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user