<?php

namespace App\Console\Commands;

use App\Models\Shop\Tag;
use App\Repositories\Shop\TagGroups;
use Illuminate\Console\Command;

class AddTagGroup extends Command
{
    protected $signature = 'addTagGroup';

    protected $description = 'Migrations of tags';

    public function __construct()
    {
        parent::__construct();
    }

    public function handle()
    {
        $tags = Tag::withTrashed()->get();
        foreach ($tags as $tag) {
            $tag->update(['group' => TagGroups::getName($tag->tag_group_id)]);
        }
    }
}
