fipamo/app/Http/Controllers/API/PageAPIController.php
ro 4337a20fb8
API Improvements #116
API Security has been reworked to check if request is secure, verifies
the API token created on site setup given to every member, and then
confirms the system is accepting API requests by way of the API enabled
toggle in settings

API usage is now only meant for backend use, so this needs to be noted
in the docs
2024-07-17 16:41:11 -06:00

41 lines
1.1 KiB
PHP

<?php
namespace App\Http\Controllers\API;
use App\Interfaces\PageRepositoryInterface;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class PageAPIController extends Controller
{
protected $pages;
public function __construct(
PageRepositoryInterface $pageRepository
) {
$this->pages = $pageRepository;
}
public function write(Request $request)
{
$body = json_decode($request->getContent());
dd($body);
//$result = $this->pages->update($body);
//return response()->json($result)->header('Content-Type', 'application/json');
}
public function create(Request $request)
{
$body = json_decode($request->getContent());
$result = $this->pages->create($body);
return response()->json($result)->header('Content-Type', 'application/json');
}
public function delete(Request $request)
{
$body = json_decode($request->getContent());
$result = $this->pages->delete($body);
return response()->json($result)->header('Content-Type', 'application/json');
}
}