Add count function for images herited

This commit is contained in:
Ludovic CANDELLIER
2022-04-16 13:58:09 +02:00
parent 2d111605f2
commit 1dc815bf39
12 changed files with 105 additions and 47 deletions

View File

@@ -7,35 +7,14 @@ 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();

View File

@@ -0,0 +1,27 @@
<?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]);
}
}
}