diff --git a/app/Http/Controllers/RoutingController.php b/app/Http/Controllers/RoutingController.php index bfd5e7f..ed02425 100644 --- a/app/Http/Controllers/RoutingController.php +++ b/app/Http/Controllers/RoutingController.php @@ -3,7 +3,7 @@ namespace App\Http\Controllers; use App\Models\Feed; -use App\Models\FeedPlatformChannel; +use App\Models\Route; use App\Models\PlatformChannel; use App\Services\RoutingValidationService; use App\Exceptions\RoutingMismatchException; @@ -132,7 +132,7 @@ public function destroy(Feed $feed, PlatformChannel $channel): RedirectResponse public function toggle(Request $request, Feed $feed, PlatformChannel $channel): RedirectResponse { - $routing = FeedPlatformChannel::where('feed_id', $feed->id) + $routing = Route::where('feed_id', $feed->id) ->where('platform_channel_id', $channel->id) ->first(); diff --git a/app/Models/Feed.php b/app/Models/Feed.php index 20efe87..306248f 100644 --- a/app/Models/Feed.php +++ b/app/Models/Feed.php @@ -83,18 +83,18 @@ public function getStatusAttribute(): string } /** - * @return BelongsToMany + * @return BelongsToMany */ public function channels(): BelongsToMany { - return $this->belongsToMany(PlatformChannel::class, 'feed_platform_channels') - ->using(FeedPlatformChannel::class) + return $this->belongsToMany(PlatformChannel::class, 'routes') + ->using(Route::class) ->withPivot(['is_active', 'priority', 'filters']) ->withTimestamps(); } /** - * @return BelongsToMany + * @return BelongsToMany */ public function activeChannels(): BelongsToMany { diff --git a/app/Models/PlatformChannel.php b/app/Models/PlatformChannel.php index 6dd5dba..b0731e2 100644 --- a/app/Models/PlatformChannel.php +++ b/app/Models/PlatformChannel.php @@ -74,18 +74,18 @@ public function getFullNameAttribute(): string } /** - * @return BelongsToMany + * @return BelongsToMany */ public function feeds(): BelongsToMany { - return $this->belongsToMany(Feed::class, 'feed_platform_channels') - ->using(FeedPlatformChannel::class) + return $this->belongsToMany(Feed::class, 'routes') + ->using(Route::class) ->withPivot(['is_active', 'priority', 'filters']) ->withTimestamps(); } /** - * @return BelongsToMany + * @return BelongsToMany */ public function activeFeeds(): BelongsToMany { diff --git a/app/Models/FeedPlatformChannel.php b/app/Models/Route.php similarity index 93% rename from app/Models/FeedPlatformChannel.php rename to app/Models/Route.php index 8da0f85..3bb80d9 100644 --- a/app/Models/FeedPlatformChannel.php +++ b/app/Models/Route.php @@ -17,9 +17,9 @@ * @property Carbon $updated_at * @method static create(array $array) */ -class FeedPlatformChannel extends Pivot +class Route extends Pivot { - protected $table = 'feed_platform_channels'; + protected $table = 'routes'; public $incrementing = false; diff --git a/app/Services/SystemStatusService.php b/app/Services/SystemStatusService.php index 290183b..2e44490 100644 --- a/app/Services/SystemStatusService.php +++ b/app/Services/SystemStatusService.php @@ -3,7 +3,7 @@ namespace App\Services; use App\Models\Feed; -use App\Models\FeedPlatformChannel; +use App\Models\Route; use App\Models\PlatformChannel; use App\Models\Setting; @@ -29,7 +29,7 @@ public function getSystemStatus(): array $reasons[] = 'No active platform channels configured'; } - if (!FeedPlatformChannel::where('is_active', true)->exists()) { + if (!Route::where('is_active', true)->exists()) { $isEnabled = false; $reasons[] = 'No active feed-to-channel routes configured'; } diff --git a/database/migrations/2025_07_05_005128_create_feed_platform_channels_table.php b/database/migrations/2025_07_05_005128_create_routes_table.php similarity index 85% rename from database/migrations/2025_07_05_005128_create_feed_platform_channels_table.php rename to database/migrations/2025_07_05_005128_create_routes_table.php index 52af4bf..7610fda 100644 --- a/database/migrations/2025_07_05_005128_create_feed_platform_channels_table.php +++ b/database/migrations/2025_07_05_005128_create_routes_table.php @@ -8,7 +8,7 @@ { public function up(): void { - Schema::create('feed_platform_channels', function (Blueprint $table) { + Schema::create('routes', function (Blueprint $table) { $table->foreignId('feed_id')->constrained()->onDelete('cascade'); $table->foreignId('platform_channel_id')->constrained()->onDelete('cascade'); $table->boolean('is_active')->default(true); @@ -22,6 +22,6 @@ public function up(): void public function down(): void { - Schema::dropIfExists('feed_platform_channels'); + Schema::dropIfExists('routes'); } }; \ No newline at end of file diff --git a/database/seeders/DatabaseSeeder.php b/database/seeders/DatabaseSeeder.php index 44312ff..264345a 100644 --- a/database/seeders/DatabaseSeeder.php +++ b/database/seeders/DatabaseSeeder.php @@ -2,24 +2,12 @@ namespace Database\Seeders; -use App\Models\User; -// use Illuminate\Database\Console\Seeds\WithoutModelEvents; use Illuminate\Database\Seeder; class DatabaseSeeder extends Seeder { - /** - * Seed the application's database. - */ public function run(): void { - // User::factory(10)->create(); - - User::factory()->create([ - 'name' => 'Test User', - 'email' => 'test@example.com', - ]); - $this->call(SettingsSeeder::class); } }