23 lines
566 B
PHP
23 lines
566 B
PHP
<?php
|
|
|
|
namespace App\Actions\GuideCard;
|
|
|
|
use App\DTOs\GuideCardData;
|
|
use App\Events\ModelChanged;
|
|
use App\Models\GuideCard;
|
|
use App\Repositories\Contracts\GuideCardRepositoryInterface;
|
|
|
|
final class UpdateGuideCardAction
|
|
{
|
|
public function __construct(private GuideCardRepositoryInterface $repository) {}
|
|
|
|
public function execute(GuideCard $guideCard, GuideCardData $data): GuideCard
|
|
{
|
|
$result = $this->repository->update($guideCard, $data->toArray());
|
|
|
|
ModelChanged::dispatch(GuideCard::class, 'updated');
|
|
|
|
return $result;
|
|
}
|
|
}
|