update deploy
This commit is contained in:
23
app/Actions/Category/UpdateCategoryAction.php
Normal file
23
app/Actions/Category/UpdateCategoryAction.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Category;
|
||||
|
||||
use App\DTOs\CategoryData;
|
||||
use App\Events\ModelChanged;
|
||||
use App\Models\Category;
|
||||
use App\Repositories\Contracts\CategoryRepositoryInterface;
|
||||
|
||||
class UpdateCategoryAction
|
||||
{
|
||||
public function __construct(private CategoryRepositoryInterface $repository) {}
|
||||
|
||||
public function execute(Category $category, CategoryData $data): Category
|
||||
{
|
||||
/** @var Category */
|
||||
$result = $this->repository->update($category, $data->toArray());
|
||||
|
||||
ModelChanged::dispatch(Category::class, 'updated');
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user