Added IP addresses API

Added IP addresses API
This commit is contained in:
cp6 2022-02-22 13:38:44 +11:00
parent e15b317bb4
commit d5620294e2
2 changed files with 18 additions and 0 deletions

View File

@ -2,6 +2,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\IPs;
use App\Models\Labels; use App\Models\Labels;
use App\Models\NetworkSpeed; use App\Models\NetworkSpeed;
use App\Models\OS; use App\Models\OS;
@ -236,6 +237,20 @@ class ApiController extends Controller
return response($os, 200); return response($os, 200);
} }
protected function getAllIPs()
{
$ip = IPs::all()->toJson(JSON_PRETTY_PRINT);
return response($ip, 200);
}
protected function getIP($id)
{
$ip = DB::table('ips as i')
->where('i.id', '=', $id)
->get()->toJson(JSON_PRETTY_PRINT);
return response($ip, 200);
}
public function getAllProvidersTable(Request $request) public function getAllProvidersTable(Request $request)
{ {
if ($request->ajax()) { if ($request->ajax()) {

View File

@ -28,6 +28,9 @@ Route::middleware('auth:api')->get('domains/{id}', 'App\Http\Controllers\ApiCont
Route::middleware('auth:api')->get('servers', 'App\Http\Controllers\ApiController@getAllServers'); Route::middleware('auth:api')->get('servers', 'App\Http\Controllers\ApiController@getAllServers');
Route::middleware('auth:api')->get('servers/{id}', 'App\Http\Controllers\ApiController@getServer'); Route::middleware('auth:api')->get('servers/{id}', 'App\Http\Controllers\ApiController@getServer');
Route::middleware('auth:api')->get('IPs/', 'App\Http\Controllers\ApiController@getAllIPs');
Route::middleware('auth:api')->get('IPs/{id}', 'App\Http\Controllers\ApiController@getIP');
Route::middleware('auth:api')->get('labels/', 'App\Http\Controllers\ApiController@getAllLabels'); Route::middleware('auth:api')->get('labels/', 'App\Http\Controllers\ApiController@getAllLabels');
Route::middleware('auth:api')->get('labels/{id}', 'App\Http\Controllers\ApiController@getLabel'); Route::middleware('auth:api')->get('labels/{id}', 'App\Http\Controllers\ApiController@getLabel');