vito/app/Traits/HasProjectThroughServer.php
2025-03-12 13:31:10 +01:00

26 lines
485 B
PHP

<?php
namespace App\Traits;
use App\Models\Project;
use App\Models\Server;
use Illuminate\Database\Eloquent\Relations\HasOneThrough;
trait HasProjectThroughServer
{
/**
* @return HasOneThrough<Project, Server, $this>
*/
public function project(): HasOneThrough
{
return $this->hasOneThrough(
Project::class,
Server::class,
'id',
'id',
'server_id',
'project_id'
);
}
}