From 7a9b6d50151cc6fc29c134570bbf0162b0135811 Mon Sep 17 00:00:00 2001 From: Deon George Date: Thu, 5 Oct 2023 22:59:59 +1100 Subject: [PATCH] Change network/ to domain/view/ --- app/Http/Controllers/DomainController.php | 12 ++++++++++++ app/Http/Controllers/HomeController.php | 13 +------------ resources/views/domain/list.blade.php | 2 +- resources/views/layouts/partials/sidebar.blade.php | 2 +- resources/views/system/view.blade.php | 4 ++-- routes/web.php | 2 +- tests/Feature/SiteAdminTest.php | 4 ++-- 7 files changed, 20 insertions(+), 19 deletions(-) diff --git a/app/Http/Controllers/DomainController.php b/app/Http/Controllers/DomainController.php index 2dea990..74eb35f 100644 --- a/app/Http/Controllers/DomainController.php +++ b/app/Http/Controllers/DomainController.php @@ -3,6 +3,7 @@ namespace App\Http\Controllers; use Illuminate\Support\Collection; +use Illuminate\Support\Facades\Gate; use App\Http\Requests\DomainRequest; use App\Models\{Address,Domain,Zone}; @@ -94,4 +95,15 @@ class DomainController extends Controller return ['id'=>$item->region_id,'value'=>sprintf('%s %s',$item->ftn_3d,$item->system->location)]; }); } + + public function view(Domain $o) + { + if (! $o->public && ! Gate::check('admin',$o)) + abort(404); + + $o->load(['zones.system','zones.domain']); + + return view('domain.view') + ->with('o',$o); + } } \ No newline at end of file diff --git a/app/Http/Controllers/HomeController.php b/app/Http/Controllers/HomeController.php index 4eac344..79ccdc8 100644 --- a/app/Http/Controllers/HomeController.php +++ b/app/Http/Controllers/HomeController.php @@ -12,7 +12,7 @@ use App\Classes\File; use App\Classes\FTN\Packet; use App\Http\Requests\SetupRequest; use App\Models\File as FileModel; -use App\Models\{Address,Domain,Echomail,Netmail,Setup,System}; +use App\Models\{Address,Echomail,Netmail,Setup,System}; class HomeController extends Controller { @@ -42,17 +42,6 @@ class HomeController extends Controller ->with('f',$f); } - public function network(Domain $o) - { - if (! $o->public && ! Gate::check('admin',$o)) - abort(404); - - $o->load(['zones.system','zones.domain']); - - return view('domain.view') - ->with('o',$o); - } - public function packet_contents(System $o,string $packet) { $nm = Netmail::select('netmails.*') diff --git a/resources/views/domain/list.blade.php b/resources/views/domain/list.blade.php index 11d8606..b7e7b1c 100644 --- a/resources/views/domain/list.blade.php +++ b/resources/views/domain/list.blade.php @@ -28,7 +28,7 @@ @if($do->active) - {{ $do->name }} + {{ $do->name }} @else {{ $do->name }} @endif diff --git a/resources/views/layouts/partials/sidebar.blade.php b/resources/views/layouts/partials/sidebar.blade.php index c5eb1bd..2d06932 100644 --- a/resources/views/layouts/partials/sidebar.blade.php +++ b/resources/views/layouts/partials/sidebar.blade.php @@ -16,7 +16,7 @@ ->when(((! $user) || (! $user->isAdmin())),function($query) { return $query->public()->active(); }) ->orderBy('name')->get() as $o) @if ($o->managed()) -
{{ $o->name }}
+
{{ $o->name }}
@endif @endforeach diff --git a/resources/views/system/view.blade.php b/resources/views/system/view.blade.php index 40430e7..2895de7 100644 --- a/resources/views/system/view.blade.php +++ b/resources/views/system/view.blade.php @@ -56,7 +56,7 @@ @foreach($o->addresses->sortBy('zone.domain.name')->groupBy('zone.domain.name') as $name => $children) - {{ $name }} + {{ $name }} {{ $children->pluck('ftn3d')->join(', ') }} @endforeach @@ -88,7 +88,7 @@ }) ->get() as $o) - {{ $domain_addresses->first()->zone->domain->name }} + {{ $domain_addresses->first()->zone->domain->name }} @if($o->count) {{ $o->count }} diff --git a/routes/web.php b/routes/web.php index cb2a0a4..abf7cde 100644 --- a/routes/web.php +++ b/routes/web.php @@ -42,7 +42,7 @@ Route::get('admin/switch/stop',[UserSwitchController::class,'user_switch_stop']) Route::get('/',[HomeController::class,'home']); Route::view('about','about'); Route::view('domain/list','domain.list'); -Route::get('network/{o}',[HomeController::class,'network']) +Route::get('domain/view/{o}',[DomainController::class,'view']) ->where('o','[0-9]+'); Route::match(['get','post'],'pkt',[HomeController::class,'pkt']); Route::view('system/list','system.list'); diff --git a/tests/Feature/SiteAdminTest.php b/tests/Feature/SiteAdminTest.php index 372be4c..0be14ae 100644 --- a/tests/Feature/SiteAdminTest.php +++ b/tests/Feature/SiteAdminTest.php @@ -26,7 +26,7 @@ class SiteAdminTest extends TestCase $this->get('zone') ->assertRedirect('login'); - $this->get('network/999') + $this->get('domain/view/999') ->assertNotFound(); Domain::factory()->create([ @@ -35,7 +35,7 @@ class SiteAdminTest extends TestCase 'public'=>TRUE, ]); - $this->get('network/999') + $this->get('domain/view/999') ->assertOK(); }