移除 后台主机的编辑名称功能
This commit is contained in:
parent
16ad46304d
commit
c5c7ac3c8a
@ -4,7 +4,9 @@
|
|||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\Host;
|
use App\Models\Host;
|
||||||
|
use Illuminate\Http\RedirectResponse;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Http\Response;
|
||||||
use Illuminate\View\View;
|
use Illuminate\View\View;
|
||||||
|
|
||||||
class HostController extends Controller
|
class HostController extends Controller
|
||||||
@ -12,7 +14,7 @@ class HostController extends Controller
|
|||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function index(Host $host)
|
public function index(Host $host)
|
||||||
{
|
{
|
||||||
@ -25,7 +27,7 @@ public function index(Host $host)
|
|||||||
/**
|
/**
|
||||||
* Show the form for creating a new resource.
|
* Show the form for creating a new resource.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
@ -36,7 +38,7 @@ public function create()
|
|||||||
* Store a newly created resource in storage.
|
* Store a newly created resource in storage.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
@ -47,7 +49,7 @@ public function store(Request $request)
|
|||||||
* Display the specified resource.
|
* Display the specified resource.
|
||||||
*
|
*
|
||||||
* @param \App\Models\Host $host
|
* @param \App\Models\Host $host
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function show(Host $host)
|
public function show(Host $host)
|
||||||
{
|
{
|
||||||
@ -58,7 +60,7 @@ public function show(Host $host)
|
|||||||
* Show the form for editing the specified resource.
|
* Show the form for editing the specified resource.
|
||||||
*
|
*
|
||||||
* @param \App\Models\Host $host
|
* @param \App\Models\Host $host
|
||||||
* @return \Illuminate\Http\Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function edit(Host $host): View
|
public function edit(Host $host): View
|
||||||
{
|
{
|
||||||
@ -70,20 +72,23 @@ public function edit(Host $host): View
|
|||||||
/**
|
/**
|
||||||
* Update the specified resource in storage.
|
* Update the specified resource in storage.
|
||||||
*
|
*
|
||||||
* @param \Illuminate\Http\Request $request
|
* @param \Illuminate\Http\Request $request
|
||||||
* @param \App\Models\Host $host
|
* @param \App\Models\Host $host
|
||||||
* @return \Illuminate\Http\Response
|
*
|
||||||
|
* @return RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function update(Request $request, Host $host)
|
public function update(Request $request, Host $host): RedirectResponse
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
|
||||||
$request->validate([
|
$request->validate([
|
||||||
'name' => 'required|string|max:255',
|
// 'name' => 'required|string|max:255',
|
||||||
'managed_price' => 'nullable|numeric',
|
'managed_price' => 'nullable|numeric',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$host->update($request->all());
|
$req = $request->only('managed_price');
|
||||||
|
|
||||||
|
$host->update($req);
|
||||||
|
|
||||||
return back()->with('success', '此主机已更新。');
|
return back()->with('success', '此主机已更新。');
|
||||||
}
|
}
|
||||||
@ -91,11 +96,15 @@ public function update(Request $request, Host $host)
|
|||||||
/**
|
/**
|
||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*
|
*
|
||||||
* @param \App\Models\Host $host
|
* @param \App\Models\Host $host
|
||||||
* @return \Illuminate\Http\Response
|
*
|
||||||
|
* @return RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function destroy(Host $host)
|
public function destroy(Host $host): RedirectResponse
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
|
$host->safeDelete();
|
||||||
|
|
||||||
|
return redirect()->route('admin.hosts.index')->with('success', '正在排队删除此主机。');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,12 @@ public function scopeThisUser($query, $module = null)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function safeDelete(): bool
|
||||||
|
{
|
||||||
|
dispatch(new \App\Jobs\Module\Host($this, 'delete'));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public function cost($price = null, $auto = true): bool
|
public function cost($price = null, $auto = true): bool
|
||||||
{
|
{
|
||||||
$this->load('user');
|
$this->load('user');
|
||||||
|
@ -11,10 +11,10 @@
|
|||||||
@csrf
|
@csrf
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
|
|
||||||
<div class="form-group">
|
{{-- <div class="form-group">--}}
|
||||||
<label for="name" class="col-sm-2 col-form-label">名称</label>
|
{{-- <label for="name" class="col-sm-2 col-form-label">名称</label>--}}
|
||||||
<input type="text" class="form-control" id="name" name="name" value="{{ $host->name }}">
|
{{-- <input type="text" class="form-control" id="name" name="name" value="{{ $host->name }}">--}}
|
||||||
</div>
|
{{-- </div>--}}
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="managed_price" class="col-sm-2 col-form-label">新的价格 (Drops)</label>
|
<label for="managed_price" class="col-sm-2 col-form-label">新的价格 (Drops)</label>
|
||||||
@ -28,6 +28,13 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
<form method="post" action="{{ route('admin.hosts.destroy', $host) }}">
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
<button type="submit" class="btn btn-danger mt-3">删除</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
Loading…
Reference in New Issue
Block a user