Adding bulk reinstall command
This commit is contained in:
parent
8385ba48b3
commit
9cf7432835
4 changed files with 146 additions and 0 deletions
|
@ -75,6 +75,26 @@ class ServerRepository extends EloquentRepository implements ServerRepositoryInt
|
|||
return $instance->get($this->getColumns());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a collection of servers with their associated data for reinstall operations.
|
||||
*
|
||||
* @param int|null $server
|
||||
* @param int|null $node
|
||||
* @return \Illuminate\Support\Collection
|
||||
*/
|
||||
public function getDataForReinstall(int $server = null, int $node = null): Collection
|
||||
{
|
||||
$instance = $this->getBuilder()->with(['allocation', 'allocations', 'pack', 'egg', 'node']);
|
||||
|
||||
if (! is_null($server) && is_null($node)) {
|
||||
$instance = $instance->where('id', '=', $server);
|
||||
} elseif (is_null($server) && ! is_null($node)) {
|
||||
$instance = $instance->where('node_id', '=', $node);
|
||||
}
|
||||
|
||||
return $instance->get($this->getColumns());
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a server model and all variables associated with the server.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue