fipamo/app/Http/Controllers/API/PageAPIController.php
ro 4f7bbcdf86
cleaned up new page creation
editing page works but making new pages was still wonky, so that was
fixed and now page creation works fine

made some minor tweaks to prettier config for css formatting
2024-03-12 16:16:36 -06:00

33 lines
851 B
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());
$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');
}
}