Added OS to API

Added OS to API
This commit is contained in:
cp6 2022-02-20 00:19:47 +11:00
parent 333c55e0f9
commit 479d66ee68
3 changed files with 23 additions and 0 deletions

View File

@ -30,6 +30,7 @@ removed.
* Misc services. * Misc services.
* DNS CRUD. * DNS CRUD.
* Reseller hosting. * Reseller hosting.
* Added Operating systems to DB, Deleting and creating them now possible.
* Make servers displayable public with config options to hide certain values. * Make servers displayable public with config options to hide certain values.
* Vue JS used where possible. * Vue JS used where possible.
* Datatables used on large tables (Locations, labels, and providers). * Datatables used on large tables (Locations, labels, and providers).
@ -110,6 +111,10 @@ All API requests must be appended with `api/` e.g `mydomain.com/api/servers/gYk8
`networkSpeeds/{id}` `networkSpeeds/{id}`
`os/`
`os/{id}`
`pricing/` `pricing/`
`pricing/{id}` `pricing/{id}`

View File

@ -4,6 +4,7 @@ namespace App\Http\Controllers;
use App\Models\Labels; use App\Models\Labels;
use App\Models\NetworkSpeed; use App\Models\NetworkSpeed;
use App\Models\OS;
use App\Models\Pricing; use App\Models\Pricing;
use App\Models\Providers; use App\Models\Providers;
use App\Models\Server; use App\Models\Server;
@ -221,6 +222,20 @@ class ApiController extends Controller
return response($settings, 200); return response($settings, 200);
} }
protected function getAllOs()
{
$os = OS::all()->toJson(JSON_PRETTY_PRINT);
return response($os, 200);
}
protected function getOs($id)
{
$os = DB::table('os as o')
->where('o.id', '=', $id)
->get()->toJson(JSON_PRETTY_PRINT);
return response($os, 200);
}
public function getAllProvidersTable(Request $request) public function getAllProvidersTable(Request $request)
{ {
if ($request->ajax()) { if ($request->ajax()) {

View File

@ -40,6 +40,9 @@ Route::middleware('auth:api')->get('misc/{id}', 'App\Http\Controllers\ApiControl
Route::middleware('auth:api')->get('networkSpeeds/', 'App\Http\Controllers\ApiController@getAllNetworkSpeeds'); Route::middleware('auth:api')->get('networkSpeeds/', 'App\Http\Controllers\ApiController@getAllNetworkSpeeds');
Route::middleware('auth:api')->get('networkSpeeds/{id}', 'App\Http\Controllers\ApiController@getNetworkSpeeds'); Route::middleware('auth:api')->get('networkSpeeds/{id}', 'App\Http\Controllers\ApiController@getNetworkSpeeds');
Route::middleware('auth:api')->get('os/', 'App\Http\Controllers\ApiController@getAllOs');
Route::middleware('auth:api')->get('os/{id}', 'App\Http\Controllers\ApiController@getOs');
Route::middleware('auth:api')->get('pricing/', 'App\Http\Controllers\ApiController@getAllPricing'); Route::middleware('auth:api')->get('pricing/', 'App\Http\Controllers\ApiController@getAllPricing');
Route::middleware('auth:api')->get('pricing/{id}', 'App\Http\Controllers\ApiController@getPricing'); Route::middleware('auth:api')->get('pricing/{id}', 'App\Http\Controllers\ApiController@getPricing');