update deploy
This commit is contained in:
22
app/Actions/Page/CreatePageAction.php
Normal file
22
app/Actions/Page/CreatePageAction.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Page;
|
||||
|
||||
use App\DTOs\PageData;
|
||||
use App\Events\ModelChanged;
|
||||
use App\Models\Page;
|
||||
use App\Repositories\Contracts\PageRepositoryInterface;
|
||||
|
||||
final class CreatePageAction
|
||||
{
|
||||
public function __construct(private PageRepositoryInterface $repository) {}
|
||||
|
||||
public function execute(PageData $data): Page
|
||||
{
|
||||
$result = $this->repository->create($data->toArray());
|
||||
|
||||
ModelChanged::dispatch(Page::class, 'created');
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
21
app/Actions/Page/DeletePageAction.php
Normal file
21
app/Actions/Page/DeletePageAction.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Page;
|
||||
|
||||
use App\Events\ModelChanged;
|
||||
use App\Models\Page;
|
||||
use App\Repositories\Contracts\PageRepositoryInterface;
|
||||
|
||||
final class DeletePageAction
|
||||
{
|
||||
public function __construct(private PageRepositoryInterface $repository) {}
|
||||
|
||||
public function execute(Page $page): bool
|
||||
{
|
||||
$this->repository->delete($page);
|
||||
|
||||
ModelChanged::dispatch(Page::class, 'deleted');
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
22
app/Actions/Page/UpdatePageAction.php
Normal file
22
app/Actions/Page/UpdatePageAction.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace App\Actions\Page;
|
||||
|
||||
use App\DTOs\PageData;
|
||||
use App\Events\ModelChanged;
|
||||
use App\Models\Page;
|
||||
use App\Repositories\Contracts\PageRepositoryInterface;
|
||||
|
||||
final class UpdatePageAction
|
||||
{
|
||||
public function __construct(private PageRepositoryInterface $repository) {}
|
||||
|
||||
public function execute(Page $page, PageData $data): Page
|
||||
{
|
||||
$result = $this->repository->update($page, $data->toArray());
|
||||
|
||||
ModelChanged::dispatch(Page::class, 'updated');
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user