<?php

use MintyPHP\Router;
use MintyPHP\Service\Branding\BrandingServicesFactory;
use MintyPHP\Support\Flash;
use MintyPHP\Support\Guard;
use MintyPHP\Service\Access\PermissionService;

Guard::requireLogin();
Guard::requirePermission(PermissionService::SETTINGS_UPDATE);

if (($_SERVER['REQUEST_METHOD'] ?? 'GET') !== 'POST') {
    Router::redirect('admin/settings');
    return;
}

$faviconService = (new BrandingServicesFactory())->createBrandingFaviconService();
$faviconService->delete();
Flash::success('Favicon removed', 'admin/settings', 'favicon_removed');
Router::redirect('admin/settings');
