Fixes port deletion for node allocations as well as server notes on allocations.
closes #305
This commit is contained in:
parent
22da8d47c8
commit
e9762b4277
4 changed files with 23 additions and 5 deletions
|
@ -108,7 +108,7 @@ class NodesController extends Controller
|
|||
'servers.user', 'servers.service',
|
||||
'servers.allocations', 'location'
|
||||
)->findOrFail($id);
|
||||
$node->setRelation('allocations', $node->allocations()->paginate(40));
|
||||
$node->setRelation('allocations', $node->allocations()->with('server')->paginate(40));
|
||||
|
||||
return view('admin.nodes.view', [
|
||||
'node' => $node,
|
||||
|
@ -151,7 +151,7 @@ class NodesController extends Controller
|
|||
|
||||
public function deallocateSingle(Request $request, $node, $allocation)
|
||||
{
|
||||
$query = Models\Allocation::where('node', $node)->whereNull('server_id')->where('id', $allocation)->delete();
|
||||
$query = Models\Allocation::where('node_id', $node)->whereNull('server_id')->where('id', $allocation)->delete();
|
||||
if ((int) $query === 0) {
|
||||
return response()->json([
|
||||
'error' => 'Unable to find an allocation matching those details to delete.',
|
||||
|
|
|
@ -74,4 +74,14 @@ class Allocation extends Model
|
|||
{
|
||||
return ! is_null($this->ip_alias);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets information for the server associated with this allocation.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function server()
|
||||
{
|
||||
return $this->belongsTo(Server::class);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue