mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-28 06:57:22 +08:00
Introduce filament
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets;
|
||||
|
||||
use App\Models\User;
|
||||
use Closure;
|
||||
use Filament\Tables;
|
||||
use Filament\Widgets\TableWidget as BaseWidget;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
|
||||
class LatestUsers extends BaseWidget
|
||||
{
|
||||
protected static ?int $sort = 1;
|
||||
|
||||
protected function getTableHeading(): string | Closure | null
|
||||
{
|
||||
return __('dashboard.latest_user.page_title');
|
||||
}
|
||||
|
||||
protected function isTablePaginationEnabled(): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
protected function getTableQuery(): Builder
|
||||
{
|
||||
return User::query()->orderBy('id', 'desc')->limit(5);
|
||||
}
|
||||
|
||||
protected function getTableColumns(): array
|
||||
{
|
||||
return [
|
||||
Tables\Columns\TextColumn::make('username'),
|
||||
Tables\Columns\TextColumn::make('email'),
|
||||
Tables\Columns\BadgeColumn::make('status')->colors(['success' => 'confirmed', 'danger' => 'pending']),
|
||||
Tables\Columns\TextColumn::make('added')->dateTime(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user