mirror of
https://github.com/cp6/my-idlers.git
synced 2024-11-16 23:42:32 +01:00
Added locations view
Added locations view
This commit is contained in:
parent
87a186fb75
commit
dc78044e47
@ -4,6 +4,7 @@ namespace App\Http\Controllers;
|
|||||||
|
|
||||||
use App\Models\Locations;
|
use App\Models\Locations;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
|
||||||
class LocationsController extends Controller
|
class LocationsController extends Controller
|
||||||
@ -33,6 +34,28 @@ class LocationsController extends Controller
|
|||||||
->with('success', 'Location Created Successfully.');
|
->with('success', 'Location Created Successfully.');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function show(Locations $location)
|
||||||
|
{
|
||||||
|
$servers = DB::table('servers as s')
|
||||||
|
->where('s.location_id', '=', $location->id)
|
||||||
|
->get(['s.id', 's.hostname'])
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
$shared = DB::table('shared_hosting as s')
|
||||||
|
->where('s.location_id', '=', $location->id)
|
||||||
|
->get(['s.id', 's.main_domain as main_domain_shared'])
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
$reseller = DB::table('reseller_hosting as r')
|
||||||
|
->where('r.location_id', '=', $location->id)
|
||||||
|
->get(['r.id', 'r.main_domain as main_domain_reseller'])
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
$data = array_merge($servers, $shared, $reseller);
|
||||||
|
|
||||||
|
return view('locations.show', compact(['location', 'data']));
|
||||||
|
}
|
||||||
|
|
||||||
public function destroy(Locations $location)
|
public function destroy(Locations $location)
|
||||||
{
|
{
|
||||||
$items = Locations::find($location->id);
|
$items = Locations::find($location->id);
|
||||||
|
@ -32,6 +32,9 @@
|
|||||||
<td class="text-nowrap">{{ $location->name }}</td>
|
<td class="text-nowrap">{{ $location->name }}</td>
|
||||||
<td class="text-nowrap">
|
<td class="text-nowrap">
|
||||||
<form action="{{ route('locations.destroy', $location->id) }}" method="POST">
|
<form action="{{ route('locations.destroy', $location->id) }}" method="POST">
|
||||||
|
<a href="{{ route('locations.show', $location->id) }}"
|
||||||
|
class="text-body mx-1">
|
||||||
|
<i class="fas fa-eye" title="view"></i></a>
|
||||||
<i class="fas fa-trash text-danger ms-3" @click="modalForm"
|
<i class="fas fa-trash text-danger ms-3" @click="modalForm"
|
||||||
id="btn-{{$location->name}}" title="{{$location->id}}"></i>
|
id="btn-{{$location->name}}" title="{{$location->id}}"></i>
|
||||||
</form>
|
</form>
|
||||||
|
54
resources/views/locations/show.blade.php
Normal file
54
resources/views/locations/show.blade.php
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
@section('title') {{ $location->name }} {{'location'}} @endsection
|
||||||
|
<x-app-layout>
|
||||||
|
<x-slot name="header">
|
||||||
|
{{ __('Location details') }}
|
||||||
|
</x-slot>
|
||||||
|
<div class="container">
|
||||||
|
<x-card class="shadow mt-3">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-md-6 mb-2">
|
||||||
|
<h2>{{ $location->name }}</h2>
|
||||||
|
</div>
|
||||||
|
<div class="col-12 col-md-6 text-md-end">
|
||||||
|
<h6 class="text-muted pe-lg-4">{{ $location->id }}</h6>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-12 col-lg-6">
|
||||||
|
<div class="table-responsive">
|
||||||
|
<table class="table table-borderless text-nowrap">
|
||||||
|
<tbody>
|
||||||
|
@foreach($data as $l)
|
||||||
|
<tr>
|
||||||
|
<td class="py-2 text-muted">
|
||||||
|
@if(isset($l->hostname))
|
||||||
|
Server
|
||||||
|
@elseif(isset($l->main_domain_shared))
|
||||||
|
Shared
|
||||||
|
@elseif(isset($l->main_domain_reseller))
|
||||||
|
Reseller
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
@if(isset($l->hostname))
|
||||||
|
<a href="{{ route('servers.show', $l->id) }}" class="text-decoration-none">{{$l->hostname}}</a>
|
||||||
|
@elseif(isset($l->main_domain_shared))
|
||||||
|
<a href="{{ route('shared.show', $l->id) }}" class="text-decoration-none">{{$l->main_domain_shared}}</a>
|
||||||
|
@elseif(isset($l->main_domain_reseller))
|
||||||
|
<a href="{{ route('reseller.show', $l->id) }}" class="text-decoration-none">{{$l->main_domain_reseller}}</a>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<x-back-button>
|
||||||
|
<x-slot name="href">{{ route('locations.index') }}</x-slot>
|
||||||
|
Go back
|
||||||
|
</x-back-button>
|
||||||
|
</x-card>
|
||||||
|
</div>
|
||||||
|
</x-app-layout>
|
Loading…
Reference in New Issue
Block a user