extend Post entity with feature slot

Adds nullable feature_slot column (unique) plus repo
findByFeatureSlot/findFeatured/update methods so admins can
pin a post into one of two slots.
This commit is contained in:
Yisroel Baum 2026-05-06 22:28:45 +03:00
parent 64a334c63e
commit f73e5a1af5
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9
6 changed files with 160 additions and 4 deletions

View file

@ -0,0 +1,24 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('posts', function (Blueprint $table) {
$table->unsignedTinyInteger('feature_slot')->nullable();
$table->unique('feature_slot');
});
}
public function down(): void
{
Schema::table('posts', function (Blueprint $table) {
$table->dropUnique(['feature_slot']);
$table->dropColumn('feature_slot');
});
}
};