Skip to content

Commit 5a706cc

Browse files
committed
fix: Missing sort order for categories resource
Resolves #712
1 parent 2855676 commit 5a706cc

File tree

3 files changed

+37
-1
lines changed

3 files changed

+37
-1
lines changed

app/Filament/Resources/Categories/CategoryResource.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,13 @@ public static function table(Table $table): Table
8282
->filtersTriggerAction(function ($action) {
8383
return $action->button()->label('Filters');
8484
})
85+
->reorderRecordsTriggerAction(function ($action) {
86+
return $action->button()->label('Sort');
87+
})
8588
->paginated([10, 25, 50, 100])
8689
->defaultPaginationPageOption(25)
90+
->defaultSort('sort_order', 'asc')
91+
->reorderable('sort_order')
8792
->columns([
8893
TextInputColumn::make('name')
8994
->label('Name')

app/Http/Controllers/XtreamApiController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use App\Enums\PlaylistChannelId;
77
use App\Facades\PlaylistFacade;
88
use App\Facades\ProxyFacade;
9+
use App\Models\Category;
910
use App\Models\Channel;
1011
use App\Models\CustomPlaylist;
1112
use App\Models\Epg;
@@ -1270,7 +1271,7 @@ public function handle(Request $request)
12701271
$seriesWithoutTags = $seriesIds->diff($seriesWithTags);
12711272

12721273
if ($seriesWithoutTags->isNotEmpty()) {
1273-
$fallbackCategories = \App\Models\Category::whereIn('id', function ($query) use ($seriesWithoutTags) {
1274+
$fallbackCategories = Category::whereIn('id', function ($query) use ($seriesWithoutTags) {
12741275
$query->select('category_id')
12751276
->from('series')
12761277
->whereIn('id', $seriesWithoutTags)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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('categories', function (Blueprint $table) {
15+
$table->decimal('sort_order', 12, 4)
16+
->after('playlist_id')
17+
->default(9999);
18+
});
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*/
24+
public function down(): void
25+
{
26+
Schema::table('categories', function (Blueprint $table) {
27+
$table->dropColumn('sort_order');
28+
});
29+
}
30+
};

0 commit comments

Comments
 (0)