Rename FeedPlatformChannel to Route
This commit is contained in:
parent
2d981081f2
commit
dd032b3a80
7 changed files with 16 additions and 28 deletions
|
|
@ -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();
|
||||
|
||||
|
|
|
|||
|
|
@ -83,18 +83,18 @@ public function getStatusAttribute(): string
|
|||
}
|
||||
|
||||
/**
|
||||
* @return BelongsToMany<PlatformChannel, $this, FeedPlatformChannel>
|
||||
* @return BelongsToMany<PlatformChannel, $this, Route>
|
||||
*/
|
||||
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<PlatformChannel, $this, FeedPlatformChannel>
|
||||
* @return BelongsToMany<PlatformChannel, $this, Route>
|
||||
*/
|
||||
public function activeChannels(): BelongsToMany
|
||||
{
|
||||
|
|
|
|||
|
|
@ -74,18 +74,18 @@ public function getFullNameAttribute(): string
|
|||
}
|
||||
|
||||
/**
|
||||
* @return BelongsToMany<Feed, $this, FeedPlatformChannel>
|
||||
* @return BelongsToMany<Feed, $this, Route>
|
||||
*/
|
||||
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<Feed, $this, FeedPlatformChannel>
|
||||
* @return BelongsToMany<Feed, $this, Route>
|
||||
*/
|
||||
public function activeFeeds(): BelongsToMany
|
||||
{
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@
|
|||
* @property Carbon $updated_at
|
||||
* @method static create(array<string, mixed> $array)
|
||||
*/
|
||||
class FeedPlatformChannel extends Pivot
|
||||
class Route extends Pivot
|
||||
{
|
||||
protected $table = 'feed_platform_channels';
|
||||
protected $table = 'routes';
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
|
|
@ -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';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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');
|
||||
}
|
||||
};
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue