<?php

namespace LaraBB\Settings\Tasks\Prefix;

use Exception;
use LaraBB\Settings\Models\Prefix;

/**
 * Class DestroyPrefixTask
 * @package LaraBB\Settings\Tasks\Prefix
 */
class DestroyTask
{
    /**
     * @param Prefix $prefix
     * @return bool|null
     * @throws Exception
     */
    public function run(Prefix $prefix): ?bool
    {
        $prefix->forums()->detach();

        return $prefix->delete();
    }
}
