Update routes for IPs controller

Update routes for IPs controller
This commit is contained in:
cp6 2022-02-21 11:23:40 +11:00
parent 807221a7c0
commit 178154c7f0
4 changed files with 210 additions and 19 deletions

View File

@ -2,34 +2,27 @@
namespace App\Http\Controllers;
use App\Models\IPs;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
class IPsController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
//
$ips = IPs::all();
return view('ips.index', compact('ips'));
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create()
{
//
return view('ips.create');
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
@ -40,7 +33,7 @@ class IPsController extends Controller
/**
* Display the specified resource.
*
* @param int $id
* @param int $id
* @return \Illuminate\Http\Response
*/
public function show($id)
@ -51,7 +44,7 @@ class IPsController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @param int $id
* @return \Illuminate\Http\Response
*/
public function edit($id)
@ -62,8 +55,8 @@ class IPsController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
@ -74,7 +67,7 @@ class IPsController extends Controller
/**
* Remove the specified resource from storage.
*
* @param int $id
* @param int $id
* @return \Illuminate\Http\Response
*/
public function destroy($id)

View File

@ -0,0 +1,133 @@
@section('title') {{'Insert DNS'}} @endsection
<x-app-layout>
<x-slot name="header">
{{ __('Insert a new DNS') }}
</x-slot>
<div class="container">
<x-card class="shadow mt-3">
<h4 class="mb-3">DNS information</h4>
<x-back-button>
<x-slot name="href">{{ route('dns.index') }}</x-slot>
Go back
</x-back-button>
<x-errors-alert></x-errors-alert>
<form action="{{ route('dns.store') }}" method="POST">
@csrf
<div class="row">
<div class="col-12 col-lg-4 mb-4">
<div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Hostname</span></div>
<input type="text"
class="form-control"
name="hostname" required>
@error('name') <span class="text-red-500">{{ $message }}
</span>@enderror
</div>
</div>
<div class="col-12 col-lg-4 mb-4">
<x-text-input>
<x-slot name="title">address</x-slot>
<x-slot name="name">address</x-slot>
</x-text-input>
</div>
<div class="col-12 col-lg-4 mb-3">
<div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Type</span></div>
<select class="form-control" name="dns_type">
<option value="A" selected>A</option>
<option value="AAAA">AAAA</option>
<option value="DNAME">DNAME</option>
<option value="MX">MX</option>
<option value="NS">NS</option>
<option value="SOA">SOA</option>
<option value="TXT">TXT</option>
<option value="URI">URI</option>
</select></div>
</div>
</div>
<div class="row mb-2">
<div class="col-12 col-lg-3 mb-4">
<x-labels-select>
<x-slot name="title">label</x-slot>
<x-slot name="name">label1</x-slot>
</x-labels-select>
</div>
<div class="col-12 col-lg-3 mb-4">
<x-labels-select>
<x-slot name="title">label</x-slot>
<x-slot name="name">label2</x-slot>
</x-labels-select>
</div>
<div class="col-12 col-lg-3 mb-4">
<x-labels-select>
<x-slot name="title">label</x-slot>
<x-slot name="name">label3</x-slot>
</x-labels-select>
</div>
<div class="col-12 col-lg-3 mb-4">
<x-labels-select>
<x-slot name="title">label</x-slot>
<x-slot name="name">label4</x-slot>
</x-labels-select>
</div>
</div>
<div class="row">
<p>Related to:</p>
<div class="col-md-3 mb-3">
<div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Server</span></div>
<select class="form-control" name="server_id">
<option value="null"></option>
@foreach ($Servers as $server)
<option value="{{ $server['id'] }}">
{{ $server['hostname'] }}
</option>
@endforeach
</select></div>
</div>
<div class="col-md-3 mb-3">
<div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Shared</span></div>
<select class="form-control" name="shared_id">
<option value="null"></option>
@foreach ($Shareds as $shared)
<option value="{{ $shared['id'] }}">
{{ $shared['hostname'] }}
</option>
@endforeach
</select></div>
</div>
<div class="col-md-3 mb-3">
<div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Reseller</span></div>
<select class="form-control" name="reseller_id">
<option value="null"></option>
@foreach ($Resellers as $reseller)
<option value="{{ $reseller['id'] }}">
{{ $reseller['hostname'] }}
</option>
@endforeach
</select></div>
</div>
<div class="col-md-3 mb-3">
<div class="input-group">
<div class="input-group-prepend"><span class="input-group-text">Domain</span></div>
<select class="form-control" name="domain_id">
<option value="null"></option>
@foreach ($Domains as $domain)
<option value="{{ $domain['id'] }}">
{{ $domain['domain'] }}.{{$domain['extension']}}
</option>
@endforeach
</select></div>
</div>
</div>
<div class="row">
<div class="col-12 col-lg-4">
<x-submit-button>Insert DNS</x-submit-button>
</div>
</div>
</form>
</x-card>
</div>
</x-app-layout>

View File

@ -0,0 +1,64 @@
@section('title') {{'IP addresses'}} @endsection
@section('style')
<x-modal-style></x-modal-style>
@endsection
<x-app-layout>
<x-slot name="header">
{{ __('IP addresses') }}
</x-slot>
<div class="container" id="app">
<x-delete-confirm-modal></x-delete-confirm-modal>
<x-card class="shadow mt-3">
<a href="{{ route('ips.create') }}" class="btn btn-primary mb-3">Add IP</a>
<x-success-alert></x-success-alert>
<div class="table-responsive">
<table class="table table-bordered">
<thead class="table-light">
<tr>
<th class="text-nowrap">Type</th>
<th class="text-nowrap">Address</th>
<th class="text-nowrap">Actions</th>
</tr>
</thead>
<tbody>
@if(!empty($dn))
@foreach($dn as $dns)
<tr>
<td class="text-nowrap">{{ $dns->is_ipv4}}</td>
<td class="text-nowrap">{{ $dns->address}}</td>
<td class="text-nowrap">
<form action="{{ route('dns.destroy', $dns->id) }}" method="POST">
<a href="{{ route('dns.show', $dns->id) }}"
class="text-body mx-1">
<i class="fas fa-eye" title="view"></i></a>
<a href="{{ route('dns.edit', $dns->id) }}"
class="text-body mx-1">
<i class="fas fa-pen" title="edit"></i></a>
@csrf
@method('DELETE')
<i class="fas fa-trash text-danger ms-3" @click="modalForm"
id="btn-{{$dns->hostname}}" title="{{$dns->id}}"></i>
</form>
</td>
</tr>
@endforeach
@else
<tr>
<td class="px-4 py-2 border text-red-500" colspan="3">No IPs found.</td>
</tr>
@endif
</tbody>
</table>
</div>
</x-card>
@if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1)
<p class="text-muted mt-4 text-end"><small>
Built on Laravel v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }}
)</small>
</p>
@endif
</div>
<x-modal-delete-script>
<x-slot name="uri">ips</x-slot>
</x-modal-delete-script>
</x-app-layout>

View File

@ -3,6 +3,7 @@
use App\Http\Controllers\AccountController;
use App\Http\Controllers\DNSController;
use App\Http\Controllers\DomainsController;
use App\Http\Controllers\IPsController;
use App\Http\Controllers\LabelsController;
use App\Http\Controllers\LocationsController;
use App\Http\Controllers\MiscController;
@ -41,7 +42,7 @@ Route::resource('dns', DNSController::class)->middleware(['auth']);
Route::resource('domains', DomainsController::class)->middleware(['auth']);
Route::resource('IPs', DomainsController::class)->middleware(['auth']);
Route::resource('IPs', IPsController::class)->middleware(['auth']);
Route::resource('labels', LabelsController::class)->middleware(['auth']);