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;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\Feed;
|
use App\Models\Feed;
|
||||||
use App\Models\FeedPlatformChannel;
|
use App\Models\Route;
|
||||||
use App\Models\PlatformChannel;
|
use App\Models\PlatformChannel;
|
||||||
use App\Services\RoutingValidationService;
|
use App\Services\RoutingValidationService;
|
||||||
use App\Exceptions\RoutingMismatchException;
|
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
|
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)
|
->where('platform_channel_id', $channel->id)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,18 +83,18 @@ public function getStatusAttribute(): string
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return BelongsToMany<PlatformChannel, $this, FeedPlatformChannel>
|
* @return BelongsToMany<PlatformChannel, $this, Route>
|
||||||
*/
|
*/
|
||||||
public function channels(): BelongsToMany
|
public function channels(): BelongsToMany
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(PlatformChannel::class, 'feed_platform_channels')
|
return $this->belongsToMany(PlatformChannel::class, 'routes')
|
||||||
->using(FeedPlatformChannel::class)
|
->using(Route::class)
|
||||||
->withPivot(['is_active', 'priority', 'filters'])
|
->withPivot(['is_active', 'priority', 'filters'])
|
||||||
->withTimestamps();
|
->withTimestamps();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return BelongsToMany<PlatformChannel, $this, FeedPlatformChannel>
|
* @return BelongsToMany<PlatformChannel, $this, Route>
|
||||||
*/
|
*/
|
||||||
public function activeChannels(): BelongsToMany
|
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
|
public function feeds(): BelongsToMany
|
||||||
{
|
{
|
||||||
return $this->belongsToMany(Feed::class, 'feed_platform_channels')
|
return $this->belongsToMany(Feed::class, 'routes')
|
||||||
->using(FeedPlatformChannel::class)
|
->using(Route::class)
|
||||||
->withPivot(['is_active', 'priority', 'filters'])
|
->withPivot(['is_active', 'priority', 'filters'])
|
||||||
->withTimestamps();
|
->withTimestamps();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return BelongsToMany<Feed, $this, FeedPlatformChannel>
|
* @return BelongsToMany<Feed, $this, Route>
|
||||||
*/
|
*/
|
||||||
public function activeFeeds(): BelongsToMany
|
public function activeFeeds(): BelongsToMany
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,9 @@
|
||||||
* @property Carbon $updated_at
|
* @property Carbon $updated_at
|
||||||
* @method static create(array<string, mixed> $array)
|
* @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;
|
public $incrementing = false;
|
||||||
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
namespace App\Services;
|
namespace App\Services;
|
||||||
|
|
||||||
use App\Models\Feed;
|
use App\Models\Feed;
|
||||||
use App\Models\FeedPlatformChannel;
|
use App\Models\Route;
|
||||||
use App\Models\PlatformChannel;
|
use App\Models\PlatformChannel;
|
||||||
use App\Models\Setting;
|
use App\Models\Setting;
|
||||||
|
|
||||||
|
|
@ -29,7 +29,7 @@ public function getSystemStatus(): array
|
||||||
$reasons[] = 'No active platform channels configured';
|
$reasons[] = 'No active platform channels configured';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FeedPlatformChannel::where('is_active', true)->exists()) {
|
if (!Route::where('is_active', true)->exists()) {
|
||||||
$isEnabled = false;
|
$isEnabled = false;
|
||||||
$reasons[] = 'No active feed-to-channel routes configured';
|
$reasons[] = 'No active feed-to-channel routes configured';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
{
|
{
|
||||||
public function up(): void
|
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('feed_id')->constrained()->onDelete('cascade');
|
||||||
$table->foreignId('platform_channel_id')->constrained()->onDelete('cascade');
|
$table->foreignId('platform_channel_id')->constrained()->onDelete('cascade');
|
||||||
$table->boolean('is_active')->default(true);
|
$table->boolean('is_active')->default(true);
|
||||||
|
|
@ -22,6 +22,6 @@ public function up(): void
|
||||||
|
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::dropIfExists('feed_platform_channels');
|
Schema::dropIfExists('routes');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -2,24 +2,12 @@
|
||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\User;
|
|
||||||
// use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class DatabaseSeeder extends Seeder
|
class DatabaseSeeder extends Seeder
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Seed the application's database.
|
|
||||||
*/
|
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
// User::factory(10)->create();
|
|
||||||
|
|
||||||
User::factory()->create([
|
|
||||||
'name' => 'Test User',
|
|
||||||
'email' => 'test@example.com',
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->call(SettingsSeeder::class);
|
$this->call(SettingsSeeder::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue