From a507434422af9e155b0382af20c8f7341d3921d0 Mon Sep 17 00:00:00 2001 From: Lance Pioch Date: Sat, 23 Mar 2024 10:58:21 -0400 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20need=20these=20anymore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Models/Server.php | 2 -- app/Models/Task.php | 15 ++++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/Models/Server.php b/app/Models/Server.php index fb82617d9..0c43ea25b 100644 --- a/app/Models/Server.php +++ b/app/Models/Server.php @@ -8,7 +8,6 @@ use Illuminate\Notifications\Notifiable; use Illuminate\Database\Query\JoinClause; use Illuminate\Support\Facades\Http; use Psr\Http\Message\ResponseInterface; -use Znck\Eloquent\Traits\BelongsToThrough; use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\BelongsTo; @@ -105,7 +104,6 @@ use App\Exceptions\Http\Server\ServerStateConflictException; */ class Server extends Model { - use BelongsToThrough; use Notifiable; /** diff --git a/app/Models/Task.php b/app/Models/Task.php index c6392b375..591bfcfbb 100644 --- a/app/Models/Task.php +++ b/app/Models/Task.php @@ -3,7 +3,7 @@ namespace App\Models; use Illuminate\Container\Container; -use Znck\Eloquent\Traits\BelongsToThrough; +use Illuminate\Database\Eloquent\Relations\HasOneThrough; use Illuminate\Database\Eloquent\Relations\BelongsTo; use App\Contracts\Extensions\HashidsInterface; @@ -24,8 +24,6 @@ use App\Contracts\Extensions\HashidsInterface; */ class Task extends Model { - use BelongsToThrough; - /** * The resource name for this model when it is transformed into an * API representation using fractal. @@ -117,8 +115,15 @@ class Task extends Model /** * Return the server a task is assigned to, acts as a belongsToThrough. */ - public function server(): \Znck\Eloquent\Relations\BelongsToThrough + public function server(): HasOneThrough { - return $this->belongsToThrough(Server::class, Schedule::class); + return $this->hasOneThrough( + Server::class, + Schedule::class, + 'id', // schedules.id + 'id', // servers.id + 'schedule_id', // tasks.schedule_id + 'server_id' // schedules.server_id + ); } }