blob: dc67136720ed632f2bdf4f705614e84e2e31bec1 (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
 | <?php
namespace Lightscale\LaralightSvg\Console\Commands;
use Lightscale\LaralightSvg\SvgService;
use Lightscale\LaralightSvg\SvgCollection;
use Illuminate\Console\Command;
class SvgClearState extends Command
{
    protected $signature = 'svg:clear {collection?}';
    protected $description = 'Clear svg state stored in cache';
    public function __construct(
        protected SvgService $svg,
    ) {
        parent::__construct();
    }
    public function handle()
    {
        $collection = $this->argument('collection');
        if ($collection === null) {
            foreach ($this->svg->getCollections() as $collection) {
                $collection->clearState();
            }
        }
        else {
            $this->svg->getCollection($collection)->clearState();
        }
        return Command::SUCCESS;
    }
}
 |