Exemplo n.º 1
0
 /**
  * Returns a list of servers assigned to me
  *
  * @return Collection|InstanceServer[]
  */
 public function instances()
 {
     return InstanceServer::with('instance')->where('server_id', $this->id)->get();
 }
 /**
  * Returns all instances registered on $serverId
  *
  * @param int $serverId
  *
  * @return Collection
  */
 protected static function findServerInstances($serverId)
 {
     return InstanceServer::join('instance_t', 'id', '=', 'instance_id')->where('server_id', '=', $serverId)->orderBy('instance_t.instance_id_text')->get(['instance_t.*']);
 }
Exemplo n.º 3
0
 /**
  * @param int|string $serverId
  *
  * @return bool True if this instance
  */
 public function belongsToServer($serverId)
 {
     $_server = $this->_getServer($serverId);
     /** @noinspection PhpUndefinedMethodInspection */
     return 0 != InstanceServer::whereRaw('server_id = :server_id AND instance_id = :instance_id', [':server_id' => $_server->id, ':instance_id' => $this->id])->count();
 }