Added location, provider and os strings to servers API

Added location, provider and os strings to servers API
This commit is contained in:
cp6 2022-02-19 11:33:04 +11:00
parent 7f7a579f27
commit 30e4adcb10

View File

@ -18,7 +18,10 @@ class ApiController extends Controller
{ {
$servers = DB::table('servers as s') $servers = DB::table('servers as s')
->Join('pricings as p', 's.id', '=', 'p.service_id') ->Join('pricings as p', 's.id', '=', 'p.service_id')
->get(['s.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date'])->toJson(JSON_PRETTY_PRINT); ->join('providers as pr', 's.provider_id', '=', 'pr.id')
->join('locations as l', 's.location_id', '=', 'l.id')
->join('os as o', 's.os_id', '=', 'o.id')
->get(['s.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date', 'pr.name as provider', 'l.name as location','o.name as os'])->toJson(JSON_PRETTY_PRINT);
return response($servers, 200); return response($servers, 200);
} }
@ -27,8 +30,11 @@ class ApiController extends Controller
{ {
$server = DB::table('servers as s') $server = DB::table('servers as s')
->Join('pricings as p', 's.id', '=', 'p.service_id') ->Join('pricings as p', 's.id', '=', 'p.service_id')
->join('providers as pr', 's.provider_id', '=', 'pr.id')
->join('locations as l', 's.location_id', '=', 'l.id')
->join('os as o', 's.os_id', '=', 'o.id')
->where('s.id', '=', $id) ->where('s.id', '=', $id)
->get(['s.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date']); ->get(['s.*', 'p.id as price_id', 'p.currency', 'p.price', 'p.term', 'p.as_usd', 'p.usd_per_month', 'p.next_due_date', 'pr.name as provider', 'l.name as location','o.name as os']);
$yabs = DB::table('yabs') $yabs = DB::table('yabs')
->where('yabs.server_id', '=', $id) ->where('yabs.server_id', '=', $id)