Don’t need these anymore

This commit is contained in:
Lance Pioch 2024-03-23 10:58:21 -04:00
parent 41f35d6956
commit a507434422
2 changed files with 10 additions and 7 deletions

View File

@ -8,7 +8,6 @@ use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Query\JoinClause; use Illuminate\Database\Query\JoinClause;
use Illuminate\Support\Facades\Http; use Illuminate\Support\Facades\Http;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Znck\Eloquent\Traits\BelongsToThrough;
use Illuminate\Database\Eloquent\Relations\HasOne; use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
@ -105,7 +104,6 @@ use App\Exceptions\Http\Server\ServerStateConflictException;
*/ */
class Server extends Model class Server extends Model
{ {
use BelongsToThrough;
use Notifiable; use Notifiable;
/** /**

View File

@ -3,7 +3,7 @@
namespace App\Models; namespace App\Models;
use Illuminate\Container\Container; use Illuminate\Container\Container;
use Znck\Eloquent\Traits\BelongsToThrough; use Illuminate\Database\Eloquent\Relations\HasOneThrough;
use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Database\Eloquent\Relations\BelongsTo;
use App\Contracts\Extensions\HashidsInterface; use App\Contracts\Extensions\HashidsInterface;
@ -24,8 +24,6 @@ use App\Contracts\Extensions\HashidsInterface;
*/ */
class Task extends Model class Task extends Model
{ {
use BelongsToThrough;
/** /**
* The resource name for this model when it is transformed into an * The resource name for this model when it is transformed into an
* API representation using fractal. * API representation using fractal.
@ -117,8 +115,15 @@ class Task extends Model
/** /**
* Return the server a task is assigned to, acts as a belongsToThrough. * 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
);
} }
} }