mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-03 14:10:57 +08:00
admin add UserModifyLog
This commit is contained in:
@@ -12,8 +12,7 @@ RUN apk add --no-cache \
|
||||
libwebp-dev \
|
||||
gmp-dev \
|
||||
oniguruma-dev \
|
||||
linux-headers \
|
||||
curl
|
||||
linux-headers
|
||||
|
||||
RUN docker-php-ext-configure gd --with-freetype --with-jpeg --with-webp
|
||||
|
||||
@@ -58,7 +57,8 @@ RUN apk add --no-cache \
|
||||
icu \
|
||||
libxml2 \
|
||||
gmp \
|
||||
oniguruma
|
||||
oniguruma \
|
||||
git
|
||||
|
||||
# 配置 www.conf
|
||||
RUN sed -i \
|
||||
|
||||
77
app/Filament/Resources/User/UserModifyLogResource.php
Normal file
77
app/Filament/Resources/User/UserModifyLogResource.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\User;
|
||||
|
||||
use App\Filament\Resources\User\UserModifyLogResource\Pages;
|
||||
use App\Filament\Resources\User\UserModifyLogResource\RelationManagers;
|
||||
use App\Models\UserModifyLog;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
|
||||
class UserModifyLogResource extends Resource
|
||||
{
|
||||
protected static ?string $model = UserModifyLog::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'User';
|
||||
|
||||
protected static ?int $navigationSort = 100;
|
||||
|
||||
public static function getNavigationLabel(): string
|
||||
{
|
||||
return __('admin.sidebar.user_modify_logs');
|
||||
}
|
||||
|
||||
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'),
|
||||
Tables\Columns\TextColumn::make('user_id')
|
||||
->label(nexus_trans("label.username"))
|
||||
->formatStateUsing(fn ($state) => username_for_admin($state))
|
||||
,
|
||||
Tables\Columns\TextColumn::make('content')->label(nexus_trans("user-modify-log.content")),
|
||||
Tables\Columns\TextColumn::make('created_at')->label(nexus_trans("label.created_at")),
|
||||
])
|
||||
->filters([
|
||||
//
|
||||
])
|
||||
->defaultSort('id', 'desc')
|
||||
->actions([
|
||||
// Tables\Actions\EditAction::make(),
|
||||
// Tables\Actions\DeleteAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
// Tables\Actions\BulkActionGroup::make([
|
||||
// Tables\Actions\DeleteBulkAction::make(),
|
||||
// ]),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ManageUserModifyLogs::route('/'),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\User\UserModifyLogResource\Pages;
|
||||
|
||||
use App\Filament\PageListSingle;
|
||||
use App\Filament\Resources\User\UserModifyLogResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ManageRecords;
|
||||
|
||||
class ManageUserModifyLogs extends PageListSingle
|
||||
{
|
||||
protected static string $resource = UserModifyLogResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
// Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -9,4 +9,14 @@ class SiteLog extends NexusModel
|
||||
|
||||
protected $fillable = ['added', 'txt', 'security_level', 'uid'];
|
||||
|
||||
public static function add($uid, $content, $isMod = false): void
|
||||
{
|
||||
self::query()->insert([
|
||||
'uid' => $uid,
|
||||
'txt' => $content,
|
||||
'security_level' => $isMod ? 'mod' : 'normal',
|
||||
'added' => now(),
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ use App\Models\LoginLog;
|
||||
use App\Models\Message;
|
||||
use App\Models\OauthProvider;
|
||||
use App\Models\Setting;
|
||||
use App\Models\SiteLog;
|
||||
use App\Models\Snatch;
|
||||
use App\Models\Torrent;
|
||||
use App\Models\User;
|
||||
|
||||
@@ -14,7 +14,7 @@ $Cache->add_whole_row();
|
||||
begin_main_frame();
|
||||
|
||||
begin_frame($lang_faq['text_welcome_to'].$SITENAME." - ".$SLOGAN);
|
||||
print($lang_faq['text_welcome_content_one'].sprintf($lang_faq['text_welcome_content_two'], \App\Models\Setting::getSiteName()));
|
||||
echo sprintf($lang_faq['text_welcome_content_one'].sprintf($lang_faq['text_welcome_content_two'], \App\Models\Setting::getSiteName(), \App\Models\Setting::getSiteName()));
|
||||
end_frame();
|
||||
|
||||
$lang_id = get_guest_lang_id();
|
||||
|
||||
@@ -43,6 +43,7 @@ return [
|
||||
'token' => '访问令牌',
|
||||
'oauth_provider' => '身份验证',
|
||||
'queue_monitor' => '队列监控',
|
||||
'user_modify_logs' => '修改记录',
|
||||
],
|
||||
'resources' => [
|
||||
'agent_allow' => [
|
||||
|
||||
5
resources/lang/zh_CN/user-modify-log.php
Normal file
5
resources/lang/zh_CN/user-modify-log.php
Normal file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'content' => '修改内容',
|
||||
];
|
||||
Reference in New Issue
Block a user