adrema/app/Maildispatcher/Actions/DestroyAction.php

26 lines
609 B
PHP
Raw Permalink Normal View History

<?php
namespace App\Maildispatcher\Actions;
use App\Maildispatcher\Models\Maildispatcher;
use Illuminate\Http\RedirectResponse;
use Lorisleiva\Actions\Concerns\AsAction;
class DestroyAction
{
use AsAction;
public function handle(Maildispatcher $maildispatcher): void
{
2023-07-17 17:08:07 +02:00
$maildispatcher->gateway->type->deleteList($maildispatcher->name, $maildispatcher->gateway->domain);
$maildispatcher->delete();
}
public function asController(Maildispatcher $maildispatcher): RedirectResponse
{
$this->handle($maildispatcher);
return redirect()->back();
}
}