Cleanup database query code.
This commit is contained in:
parent
99812b0407
commit
0720bfe62f
2 changed files with 2 additions and 5 deletions
|
@ -48,10 +48,7 @@ class DatabaseController extends Controller
|
||||||
{
|
{
|
||||||
return view('admin.databases.index', [
|
return view('admin.databases.index', [
|
||||||
'databases' => Models\Database::with('server')->paginate(50),
|
'databases' => Models\Database::with('server')->paginate(50),
|
||||||
'hosts' => Models\DatabaseServer::select(
|
'hosts' => Models\DatabaseServer::withCount('databases')->with('node')->paginate(20),
|
||||||
'database_servers.*',
|
|
||||||
DB::raw('(SELECT COUNT(*) FROM `databases` WHERE `databases`.`db_server` = database_servers.id) as c_databases')
|
|
||||||
)->with('node')->paginate(20),
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@
|
||||||
<td>{{ $database->name }}</td>
|
<td>{{ $database->name }}</td>
|
||||||
<td><code>{{ $database->host }}:{{ $database->port }}</code></td>
|
<td><code>{{ $database->host }}:{{ $database->port }}</code></td>
|
||||||
<td>{{ $database->username }}</td>
|
<td>{{ $database->username }}</td>
|
||||||
<td class="text-center">{{ $database->c_databases }}</td>
|
<td class="text-center">{{ $database->databases_count }}</td>
|
||||||
<td>@if(is_null($database->node))<em>unlinked</em>@else{{ $database->node->name }}@endif</td>
|
<td>@if(is_null($database->node))<em>unlinked</em>@else{{ $database->node->name }}@endif</td>
|
||||||
<td class="text-center"><a href="#" class="text-danger" data-action="delete" data-type="delete-server" data-attr="{{ $database->id }}"><i class="fa fa-trash-o"></i></a></td>
|
<td class="text-center"><a href="#" class="text-danger" data-action="delete" data-type="delete-server" data-attr="{{ $database->id }}"><i class="fa fa-trash-o"></i></a></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
Loading…
Reference in a new issue