<?php
$iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('resources/views'));

$pattern = '/\s*<div class="bg-blue-600 p-1\.5 rounded-lg text-white not-italic">\s*<i class="[a-zA-Z-\s]+"><\/i>\s*<\/div>/i';

foreach ($iterator as $file) {
    if ($file->isFile() && strpos($file->getFilename(), '.blade.php') !== false) {
        $c = file_get_contents($file->getPathname());
        if(preg_match($pattern, $c) && strpos($file->getPathname(), 'components') === false) { // Don't remove bouncing logo in Loading component
            $new_c = preg_replace($pattern, '', $c);
            file_put_contents($file->getPathname(), $new_c);
            echo "Removed logo topnav in ".$file->getFilename()."\n";
        }
    }
}
