feat(server): add show_on_tv product flag and public /tv products API

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-18 17:17:01 +03:30
co-authored by Cursor
parent da9f98b958
commit e158831fd3
6 changed files with 177 additions and 0 deletions
@@ -0,0 +1,43 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
if (!Schema::hasTable('products')) {
return;
}
if (!Schema::hasColumn('products', 'show_on_tv')) {
Schema::table('products', function (Blueprint $table) {
if (Schema::hasColumn('products', 'show_in_assets')) {
$table->boolean('show_on_tv')->default(false)->after('show_in_assets');
} elseif (Schema::hasColumn('products', 'show')) {
$table->boolean('show_on_tv')->default(false)->after('show');
} else {
$table->boolean('show_on_tv')->default(false);
}
});
} else {
DB::statement(
'ALTER TABLE `products` MODIFY COLUMN `show_on_tv` TINYINT(1) NOT NULL DEFAULT 0'
);
}
}
public function down(): void
{
if (!Schema::hasTable('products') || !Schema::hasColumn('products', 'show_on_tv')) {
return;
}
Schema::table('products', function (Blueprint $table) {
$table->dropColumn('show_on_tv');
});
}
};