Return packs associated with a service when viewing it on the API.
This commit is contained in:
parent
6220f710df
commit
32c21baab0
2 changed files with 11 additions and 0 deletions
|
@ -55,6 +55,7 @@ class ServiceController extends BaseController
|
||||||
'options' => Models\ServiceOptions::select('id', 'name', 'description', 'tag', 'docker_image')
|
'options' => Models\ServiceOptions::select('id', 'name', 'description', 'tag', 'docker_image')
|
||||||
->where('parent_service', $service->id)
|
->where('parent_service', $service->id)
|
||||||
->with('variables')
|
->with('variables')
|
||||||
|
->with('packs')
|
||||||
->get(),
|
->get(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,4 +60,14 @@ class ServiceOptions extends Model
|
||||||
{
|
{
|
||||||
return $this->hasMany(ServiceVariables::class, 'option_id');
|
return $this->hasMany(ServiceVariables::class, 'option_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets all packs associated with this service.
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
||||||
|
*/
|
||||||
|
public function packs()
|
||||||
|
{
|
||||||
|
return $this->hasMany(ServicePack::class, 'option');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue