コード例 #1
0
ファイル: Server.php プロジェクト: pkdevboxy/dfe-database
 /**
  * Returns a list of servers assigned to me
  *
  * @return Collection|InstanceServer[]
  */
 public function instances()
 {
     return InstanceServer::with('instance')->where('server_id', $this->id)->get();
 }
コード例 #2
0
 /**
  * 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.*']);
 }
コード例 #3
0
ファイル: Instance.php プロジェクト: pkdevboxy/dfe-database
 /**
  * @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();
 }