Add variations, slider, fix cart ...
This commit is contained in:
50
app/Console/Commands/untranslateShelves.php
Normal file
50
app/Console/Commands/untranslateShelves.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Command;
|
||||
use App\Models\Shop\Category;
|
||||
|
||||
class untranslateShelves extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'untranslateShelves';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Migrations of shelves';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user