<?php

namespace LaraBB\Group\UI\Web\Handlers\Admin;

use App\Http\Controllers\Controller;
use LaraBB\Group\Actions\Admin\DestroyAction;
use LaraBB\Group\UI\Web\Requests\Destroy;

/**
 * Class DestroyHandler
 * @package LaraBB\User\UI\Web\Handlers\Admin
 */
class DestroyHandler extends Controller
{
        /**
     * DestroyHandler constructor.
     * @param DestroyAction $destroyAction
     */
    public function __construct(private readonly DestroyAction $destroyAction)
    {

    }

    /**
     * @param Destroy $request
     * @return mixed
     * @throws \Exception
     */
    public function __invoke(Destroy $request)
    {
        return $this->destroyAction->run($request) ? $request->success() : $request->failed();
    }
}
