[Breaking] Return server allocations automatically as a relation object
This commit is contained in:
parent
5c18fd1f0c
commit
bfb28f949d
3 changed files with 26 additions and 13 deletions
|
@ -24,13 +24,11 @@ class AllocationTransformer extends BaseClientTransformer
|
|||
*/
|
||||
public function transform(Allocation $model)
|
||||
{
|
||||
$model->loadMissing('server');
|
||||
|
||||
return [
|
||||
'ip' => $model->ip,
|
||||
'alias' => $model->ip_alias,
|
||||
'ip_alias' => $model->ip_alias,
|
||||
'port' => $model->port,
|
||||
'default' => $model->getRelation('server')->allocation_id === $model->id,
|
||||
'is_default' => $model->server->allocation_id === $model->id,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue