<?php

namespace App\Console\Commands;

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

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]);
        }
    }
}
