Skip to content

Commit 1bcff33

Browse files
committed
add (global) sorting to server list
1 parent cbacc18 commit 1bcff33

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

app/Filament/App/Resources/ServerResource/Pages/ListServers.php

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public function table(Table $table): Table
2525
->paginated(false)
2626
->query(fn () => $baseQuery)
2727
->poll('15s')
28+
->reorderable('sort')
29+
->defaultSort('sort')
2830
->columns([
2931
Stack::make([
3032
ServerEntryColumn::make('server_entry')
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*/
12+
public function up(): void
13+
{
14+
Schema::table('servers', function (Blueprint $table) {
15+
$table->unsignedSmallInteger('sort')->nullable();
16+
});
17+
}
18+
19+
/**
20+
* Reverse the migrations.
21+
*/
22+
public function down(): void
23+
{
24+
Schema::table('servers', function (Blueprint $table) {
25+
$table->dropColumn('sort');
26+
});
27+
}
28+
};

0 commit comments

Comments
 (0)