diff --git a/app/Http/Controllers/ServerController.php b/app/Http/Controllers/ServerController.php index d1d1d44..c8d493f 100644 --- a/app/Http/Controllers/ServerController.php +++ b/app/Http/Controllers/ServerController.php @@ -23,17 +23,27 @@ class ServerController extends Controller public function index() { - $servers = Cache::remember('all_servers', 1440, function () { + $servers = Cache::remember('all_active_servers', 1440, function () { return DB::table('servers as s') ->join('pricings as pr', 's.id', '=', 'pr.service_id') ->join('providers as p', 's.provider_id', '=', 'p.id') ->join('locations as l', 's.location_id', '=', 'l.id') ->join('os as o', 's.os_id', '=', 'o.id') + ->where('s.active', '=', 1) ->get(['s.*', 'pr.currency', 'pr.price', 'pr.term', 'pr.as_usd', 'pr.next_due_date', 'p.name as provider_name', 'l.name as location', 'o.name as os_name']); - }); - return view('servers.index', compact(['servers'])); + $non_active_servers = Cache::remember('non_active_servers', 1440, function () { + return DB::table('servers as s') + ->join('pricings as pr', 's.id', '=', 'pr.service_id') + ->join('providers as p', 's.provider_id', '=', 'p.id') + ->join('locations as l', 's.location_id', '=', 'l.id') + ->join('os as o', 's.os_id', '=', 'o.id') + ->where('s.active', '=', 0) + ->get(['s.*', 'pr.currency', 'pr.price', 'pr.term', 'pr.as_usd', 'p.name as provider_name', 'l.name as location', 'o.name as os_name']); + }); + + return view('servers.index', compact(['servers', 'non_active_servers'])); } public function showServersPublic() @@ -172,7 +182,8 @@ class ServerController extends Controller Cache::forget('services_count');//Main page services_count cache Cache::forget('due_soon');//Main page due_soon cache Cache::forget('recently_added');//Main page recently_added cache - Cache::forget('all_servers');//all servers cache + Cache::forget('all_active_servers');//all servers cache + Cache::forget('non_active_servers');//all servers cache return redirect()->route('servers.index') ->with('success', 'Server Created Successfully.'); @@ -313,7 +324,8 @@ class ServerController extends Controller Cache::forget('services_count');//Main page services_count cache Cache::forget('due_soon');//Main page due_soon cache Cache::forget('recently_added');//Main page recently_added cache - Cache::forget('all_servers');//all servers cache + Cache::forget('all_active_servers');//all servers cache + Cache::forget('non_active_servers');//all servers cache return redirect()->route('servers.index') ->with('success', 'Server Updated Successfully.'); @@ -335,7 +347,8 @@ class ServerController extends Controller Cache::forget('services_count');//Main page services_count cache Cache::forget('due_soon');//Main page due_soon cache Cache::forget('recently_added');//Main page recently_added cache - Cache::forget('all_servers');//all servers cache + Cache::forget('all_active_servers');//all servers cache + Cache::forget('non_active_servers');//all servers cache return redirect()->route('servers.index') ->with('success', 'Server was deleted Successfully.'); diff --git a/resources/views/servers/index.blade.php b/resources/views/servers/index.blade.php index 89951e0..c35fd0f 100644 --- a/resources/views/servers/index.blade.php +++ b/resources/views/servers/index.blade.php @@ -12,138 +12,236 @@
- - Add server - Compare servers - -
- - - - - - - - - - - - - - - - - - - @if(!empty($servers)) - @foreach($servers as $server) - - - - - - - - - - - - - + +
NameOSLocationProviderPriceDue inHad sinceActions
{{ $server->hostname }} - {{ App\Models\Server::serviceServerType($server->server_type) }} - {!!App\Models\Server::osIntToIcon($server->os_id, $server->os_name)!!}{{$server->cpu}} - @if($server->ram_as_mb > 1024) - {{ number_format(($server->ram_as_mb / 1000),0) }}GB - @else - {{$server->ram_as_mb}}MB - @endif - - @if($server->disk > 1000) - {{ number_format(($server->disk / 1000),1) }}TB - @else - {{$server->disk}}GB - @endif - {{ $server->location }}{{ $server->provider_name }}{{ $server->price }} {{$server->currency}} {{\App\Process::paymentTermIntToString($server->term)}} - {{now()->diffInDays(Carbon\Carbon::parse($server->next_due_date))}} - days {{ $server->owned_since }} -
- - - - - - - - - - -
-
+ + + + + + + + + + + + + + - @endforeach - @else - - - - @endif - -
NameOSLocationProviderPriceDue inHad sinceActions
No servers found.
+ + + @if(!empty($servers)) + @foreach($servers as $server) + + {{ $server->hostname }} + + {{ App\Models\Server::serviceServerType($server->server_type) }} + + {!!App\Models\Server::osIntToIcon($server->os_id, $server->os_name)!!} + {{$server->cpu}} + + @if($server->ram_as_mb > 1024) + {{ number_format(($server->ram_as_mb / 1000),0) }}GB + @else + {{$server->ram_as_mb}}MB + @endif + + + @if($server->disk > 1000) + {{ number_format(($server->disk / 1000),1) }}TB + @else + {{$server->disk}}GB + @endif + + {{ $server->location }} + {{ $server->provider_name }} + {{ $server->price }} {{$server->currency}} {{\App\Process::paymentTermIntToString($server->term)}} + + {{now()->diffInDays(Carbon\Carbon::parse($server->next_due_date))}} + days + {{ $server->owned_since }} + +
+ + + + + + + + + + +
+ + + @endforeach + @else + + No servers found. + + @endif + + +
+
- +
+ + Add server + Compare + servers + +
+ + + + + + + + + + + + + + + + + + @if(!empty($non_active_servers)) + @foreach($non_active_servers as $server) + + + + + + + + + + + + + + @endforeach + @else + + + + @endif + +
NameOSLocationProviderPriceHad sinceActions
{{ $server->hostname }} + {{ App\Models\Server::serviceServerType($server->server_type) }} + {!!App\Models\Server::osIntToIcon($server->os_id, $server->os_name)!!}{{$server->cpu}} + @if($server->ram_as_mb > 1024) + {{ number_format(($server->ram_as_mb / 1000),0) }}GB + @else + {{$server->ram_as_mb}}MB + @endif + + @if($server->disk > 1000) + {{ number_format(($server->disk / 1000),1) }}TB + @else + {{$server->disk}}GB + @endif + {{ $server->location }}{{ $server->provider_name }}{{ $server->price }} {{$server->currency}} {{\App\Process::paymentTermIntToString($server->term)}} {{ $server->owned_since }} +
+ + + + + + - @if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1) -

Built on Laravel - v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})

- @endif - + + + +
+
No non-active servers found.
+
+
+
+ @if(Session::has('timer_version_footer') && Session::get('timer_version_footer') === 1) +

Built on Laravel + v{{ Illuminate\Foundation\Application::VERSION }} (PHP v{{ PHP_VERSION }})

+ @endif + - + }); +