改进 关联显示
This commit is contained in:
parent
e500341d68
commit
0b33aef582
@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Controllers\Admin;
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\Host;
|
||||||
use App\Models\Module;
|
use App\Models\Module;
|
||||||
use Illuminate\Http\RedirectResponse;
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@ -86,7 +87,9 @@ public function show(Module $module): View
|
|||||||
{
|
{
|
||||||
$years = $module->calculate();
|
$years = $module->calculate();
|
||||||
|
|
||||||
return view('admin.modules.show', compact('module', 'years'));
|
$hosts = Host::where('module_id', $module->id)->latest()->paginate(50);
|
||||||
|
|
||||||
|
return view('admin.modules.show', compact('module', 'years', 'hosts'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ route('admin.hosts.edit', $host) }}" class="module_name"
|
<a href="{{ route('admin.modules.show', $host->module_id) }}" class="module_name"
|
||||||
module="{{ $host->module_id }}">{{ $host->module_id }}</a>
|
module="{{ $host->module_id }}">{{ $host->module_id }}</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
|
@ -7,6 +7,51 @@
|
|||||||
<a class="mt-3" href="{{ route('admin.modules.edit', $module) }}">编辑</a>
|
<a class="mt-3" href="{{ route('admin.modules.edit', $module) }}">编辑</a>
|
||||||
<h4 class="mt-2">收益</h4>
|
<h4 class="mt-2">收益</h4>
|
||||||
<div>
|
<div>
|
||||||
<x-module-earning :module="$module" />
|
<x-module-earning :module="$module"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h4 class="mt-2">主机</h4>
|
||||||
|
<div class="overflow-auto">
|
||||||
|
<table class="table table-hover">
|
||||||
|
<thead>
|
||||||
|
<th>ID</th>
|
||||||
|
<th>名称</th>
|
||||||
|
<th>用户</th>
|
||||||
|
<th>创建时间</th>
|
||||||
|
<th>更新时间</th>
|
||||||
|
<th>操作</th>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
@foreach ($hosts as $host)
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<a href="{{ route('admin.hosts.edit', $host) }}">
|
||||||
|
{{ $host->id }}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ $host->name }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{ route('admin.users.edit', $host->user_id) }}"> {{ $host->user->name }}</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ $host->created_at }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{{ $host->updated_at }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{ route('admin.hosts.edit', $host) }}" class="btn btn-primary btn-sm">编辑</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{-- 分页 --}}
|
||||||
|
{{ $hosts->links() }}
|
||||||
@endsection
|
@endsection
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
<th>ID</th>
|
<th>ID</th>
|
||||||
<th>标题</th>
|
<th>标题</th>
|
||||||
<th>模块</th>
|
<th>模块</th>
|
||||||
|
<th>主机</th>
|
||||||
<th>发起者</th>
|
<th>发起者</th>
|
||||||
<th>状态</th>
|
<th>状态</th>
|
||||||
<th>操作</th>
|
<th>操作</th>
|
||||||
@ -35,6 +36,17 @@ class="module_name"
|
|||||||
module="{{ $workOrder->module_id }}">{{ $workOrder->module_id }}
|
module="{{ $workOrder->module_id }}">{{ $workOrder->module_id }}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
|
<td>
|
||||||
|
@if ($workOrder->host_id)
|
||||||
|
<a
|
||||||
|
href="{{ route('admin.hosts.edit', $workOrder->host_id) }}"
|
||||||
|
class="host_name"
|
||||||
|
host="{{ $workOrder->host_id }}">{{ $workOrder->host_id }}
|
||||||
|
</a>
|
||||||
|
@else
|
||||||
|
无
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{ route('admin.users.edit', $workOrder->user_id) }}">{{ $workOrder->user->name }}</a>
|
<a href="{{ route('admin.users.edit', $workOrder->user_id) }}">{{ $workOrder->user->name }}</a>
|
||||||
</td>
|
</td>
|
||||||
|
Loading…
Reference in New Issue
Block a user