amber-laravel/app/Http/Controllers/Web/ToolController.php
2024-07-24 01:35:03 +08:00

76 lines
1.5 KiB
PHP

<?php
namespace App\Http\Controllers\Web;
use Apiboard\OpenAPI\OpenAPI;
use App\Http\Controllers\Controller;
use App\Repositories\Tool\Tool;
use cebe\openapi\exceptions\IOException;
use cebe\openapi\exceptions\TypeErrorException;
use cebe\openapi\exceptions\UnresolvableReferenceException;
use cebe\openapi\json\InvalidJsonPointerSyntaxException;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Http;
class ToolController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
}
/**
* Store a newly created resource in storage.
* @throws \Exception
*/
public function store(Request $request)
{
$request->validate([
'name' => 'string|required',
'description' => 'string|nullable',
'url' => 'string|required',
'api_key' => 'string|nullable',
]);
$url = $request->input('url');
$url = "localhost:8081/fn.php";
$json = Http::get($url);
$tool = new Tool($json->json());
dd($tool);
}
/**
* Display the specified resource.
*/
public function show(string $id)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, string $id)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(string $id)
{
//
}
}