Change network/ to domain/view/

This commit is contained in:
Deon George 2023-10-05 22:59:59 +11:00
parent 654e7bd2aa
commit 7a9b6d5015
7 changed files with 20 additions and 19 deletions

View File

@ -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);
}
}

View File

@ -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.*')

View File

@ -28,7 +28,7 @@
<tr>
<td>
@if($do->active)
<a href="{{ url('network',$do->id) }}">{{ $do->name }}</a>
<a href="{{ url('domain/view',$do->id) }}">{{ $do->name }}</a>
@else
{{ $do->name }}
@endif

View File

@ -16,7 +16,7 @@
->when(((! $user) || (! $user->isAdmin())),function($query) { return $query->public()->active(); })
->orderBy('name')->get() as $o)
@if ($o->managed())
<dd><a href="{{ url('network',['id'=>$o->id]) }}">{{ $o->name }}</a></dd>
<dd><a href="{{ url('domain/view',['id'=>$o->id]) }}">{{ $o->name }}</a></dd>
@endif
@endforeach
</dl>

View File

@ -56,7 +56,7 @@
<tbody>
@foreach($o->addresses->sortBy('zone.domain.name')->groupBy('zone.domain.name') as $name => $children)
<tr>
<td><a href="{{ url('network',[$children->first()->zone->domain_id]) }}">{{ $name }}</a></td>
<td><a href="{{ url('domain/view',[$children->first()->zone->domain_id]) }}">{{ $name }}</a></td>
<td>{{ $children->pluck('ftn3d')->join(', ') }}</td>
</tr>
@endforeach
@ -88,7 +88,7 @@
})
->get() as $o)
<tr>
<td><a href="{{ url('network',[$did]) }}">{{ $domain_addresses->first()->zone->domain->name }}</a></td>
<td><a href="{{ url('domain/view',[$did]) }}">{{ $domain_addresses->first()->zone->domain->name }}</a></td>
@if($o->count)
<td class="text-end">{{ $o->count }}</td>

View File

@ -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');

View File

@ -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();
}