From e1bbcc3c9f7edb6c79dde82207cd8713912ac411 Mon Sep 17 00:00:00 2001 From: cp6 Date: Mon, 16 May 2022 16:36:58 +1000 Subject: [PATCH] Added Seedbox to API Added Seedbox to API --- app/Http/Controllers/ApiController.php | 17 +++++++++++++++++ routes/api.php | 3 +++ 2 files changed, 20 insertions(+) diff --git a/app/Http/Controllers/ApiController.php b/app/Http/Controllers/ApiController.php index 89b64dd..ced080c 100644 --- a/app/Http/Controllers/ApiController.php +++ b/app/Http/Controllers/ApiController.php @@ -142,6 +142,23 @@ class ApiController extends Controller return response($reseller, 200); } + protected function getAllSeedbox() + { + $reseller = DB::table('seedboxes as sb') + ->Join('pricings as p', 'sb.id', '=', 'p.service_id') + ->get(['sb.*', '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); + return response($reseller, 200); + } + + protected function getSeedbox($id) + { + $reseller = DB::table('seedboxes as sb') + ->Join('pricings as p', 'sb.id', '=', 'p.service_id') + ->where('sb.id', '=', $id) + ->get(['sb.*', '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); + return response($reseller, 200); + } + protected function getAllDomains() { $domains = DB::table('domains as d') diff --git a/routes/api.php b/routes/api.php index cfbad94..71f4515 100644 --- a/routes/api.php +++ b/routes/api.php @@ -55,6 +55,9 @@ Route::middleware('auth:api')->get('providers/{id}', 'App\Http\Controllers\ApiCo Route::middleware('auth:api')->get('reseller/', 'App\Http\Controllers\ApiController@getAllReseller'); Route::middleware('auth:api')->get('reseller/{id}', 'App\Http\Controllers\ApiController@getReseller'); +Route::middleware('auth:api')->get('seedbox/', 'App\Http\Controllers\ApiController@getAllSeedbox'); +Route::middleware('auth:api')->get('seedbox/{id}', 'App\Http\Controllers\ApiController@getSeedbox'); + Route::middleware('auth:api')->get('settings/', 'App\Http\Controllers\ApiController@getAllSettings'); Route::middleware('auth:api')->get('shared/', 'App\Http\Controllers\ApiController@getAllShared');