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 :)
19 lines
325 B
PHP
19 lines
325 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Services;
|
|
|
|
use App\Models\Article;
|
|
|
|
class ArticleService
|
|
{
|
|
public function create(array $data): Article
|
|
{
|
|
return Article::create([
|
|
'title' => $data['name'],
|
|
'main' => $data['content'],
|
|
'published' => true,
|
|
]);
|
|
}
|
|
}
|