Added the ability to add project information.
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
<?php declare(strict_types=1);
|
||||
|
||||
namespace App\Services\ProjectContent;
|
||||
|
||||
use App\Models\ProjectContent;
|
||||
|
||||
final readonly class ProjectContentCommandHandler
|
||||
{
|
||||
public function handleStore(int $projectId, int $languageId, array $data): ProjectContent
|
||||
{
|
||||
$content = new ProjectContent();
|
||||
$content->project_id = $projectId;
|
||||
$content->language_id = $languageId;
|
||||
|
||||
$content->fill($data);
|
||||
$content->save();
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
public function handleUpdate(ProjectContent $content, array $data): ProjectContent
|
||||
{
|
||||
$content->update($data);
|
||||
|
||||
return $content;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user