Refactor of micropub request handling

Trying to organise the code better. It now temporarily doesn’t support
update requests. Thought the spec defines them as SHOULD features and
not MUST features. So safe for now :)
This commit is contained in:
Jonny Barnes 2025-04-27 16:38:25 +01:00
parent 23c275945a
commit 83d10e1a70
Signed by: jonny
SSH key fingerprint: SHA256:CTuSlns5U7qlD9jqHvtnVmfYV3Zwl2Z7WnJ4/dqOaL8
26 changed files with 699 additions and 352 deletions

View file

@ -6,13 +6,13 @@ namespace App\Services;
use App\Models\Article;
class ArticleService extends Service
class ArticleService
{
public function create(array $request, ?string $client = null): Article
public function create(array $data): Article
{
return Article::create([
'title' => $this->getDataByKey($request, 'name'),
'main' => $this->getDataByKey($request, 'content'),
'title' => $data['name'],
'main' => $data['content'],
'published' => true,
]);
}