mirror of
https://github.com/cp6/my-idlers.git
synced 2024-11-16 15:33:44 +01:00
Added providers view
Added providers view
This commit is contained in:
parent
dc78044e47
commit
1f33eebf3c
@ -5,6 +5,7 @@ namespace App\Http\Controllers;
|
||||
use App\Models\Providers;
|
||||
use DataTables;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ProvidersController extends Controller
|
||||
{
|
||||
@ -33,6 +34,28 @@ class ProvidersController extends Controller
|
||||
->with('success', 'Provider Created Successfully.');
|
||||
}
|
||||
|
||||
public function show(Providers $provider)
|
||||
{
|
||||
$servers = DB::table('servers as s')
|
||||
->where('s.provider_id', '=', $provider->id)
|
||||
->get(['s.id', 's.hostname'])
|
||||
->toArray();
|
||||
|
||||
$shared = DB::table('shared_hosting as s')
|
||||
->where('s.provider_id', '=', $provider->id)
|
||||
->get(['s.id', 's.main_domain as main_domain_shared'])
|
||||
->toArray();
|
||||
|
||||
$reseller = DB::table('reseller_hosting as r')
|
||||
->where('r.provider_id', '=', $provider->id)
|
||||
->get(['r.id', 'r.main_domain as main_domain_reseller'])
|
||||
->toArray();
|
||||
|
||||
$data = array_merge($servers, $shared, $reseller);
|
||||
|
||||
return view('providers.show', compact(['provider', 'data']));
|
||||
}
|
||||
|
||||
public function destroy(Providers $provider)
|
||||
{
|
||||
$items = Providers::find($provider->id);
|
||||
@ -49,7 +72,7 @@ class ProvidersController extends Controller
|
||||
$data = Providers::latest()->get();
|
||||
$dt = Datatables::of($data)
|
||||
->addIndexColumn()
|
||||
->addColumn('action', function($row){
|
||||
->addColumn('action', function ($row) {
|
||||
$actionBtn = '<a href="javascript:void(0)" class="edit btn btn-success btn-sm">Edit</a> <a href="javascript:void(0)" class="delete btn btn-danger btn-sm">Delete</a>';
|
||||
return $actionBtn;
|
||||
})
|
||||
|
@ -32,6 +32,9 @@
|
||||
<td class="text-nowrap">{{ $provider->name }}</td>
|
||||
<td class="text-nowrap">
|
||||
<form action="{{ route('providers.destroy', $provider->id) }}" method="POST">
|
||||
<a href="{{ route('providers.show', $provider->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"
|
||||
id="btn-{{$provider->name}}" title="{{$provider->id}}"></i>
|
||||
</form>
|
||||
|
54
resources/views/providers/show.blade.php
Normal file
54
resources/views/providers/show.blade.php
Normal file
@ -0,0 +1,54 @@
|
||||
@section('title') {{ $provider->name }} {{'provider'}} @endsection
|
||||
<x-app-layout>
|
||||
<x-slot name="header">
|
||||
{{ __('Provider 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>{{ $provider->name }}</h2>
|
||||
</div>
|
||||
<div class="col-12 col-md-6 text-md-end">
|
||||
<h6 class="text-muted pe-lg-4">{{ $provider->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('providers.index') }}</x-slot>
|
||||
Go back
|
||||
</x-back-button>
|
||||
</x-card>
|
||||
</div>
|
||||
</x-app-layout>
|
Loading…
Reference in New Issue
Block a user