30 lines
789 B
PHP
30 lines
789 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use Illuminate\Console\Command;
|
|
use App\Models\Shop\Category;
|
|
|
|
class untranslateShelves extends Command
|
|
{
|
|
protected $signature = 'untranslateShelves';
|
|
protected $description = 'Migrations of shelves';
|
|
|
|
public function __construct()
|
|
{
|
|
parent::__construct();
|
|
}
|
|
|
|
public function handle()
|
|
{
|
|
$categories = Category::all();
|
|
foreach ($categories as $category) {
|
|
$trans = json_decode($category->name, true);
|
|
$name = $trans['fr'];
|
|
$trans = $category->description ? json_decode($category->description, true) : false;
|
|
$description = $trans ? $trans['fr'] : '';
|
|
$category->update(['name' => $name, 'description' => $description]);
|
|
}
|
|
}
|
|
}
|