<?php

namespace App\Console\Commands;

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

class UntranslateTags extends Command
{
    protected $signature = 'untranslateTags';

    protected $description = 'Migrations of tags';

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

    public function handle()
    {
        $tags = Tag::withTrashed()->get();
        foreach ($tags as $tag) {
            $trans = json_decode($tag->name, true);
            $name = $trans['fr'];
            $tag->update(['name' => $name]);
        }
    }
}
