This commit is contained in:
Benjamin Takats
2022-12-04 19:42:27 +01:00
parent ffd465076a
commit 3c28f79aa6
29 changed files with 664 additions and 6 deletions

View File

@@ -0,0 +1,38 @@
<?php
namespace App\Console\Commands\Database;
use App\Models\Tag;
use Illuminate\Console\Command;
class CreateTags extends Command
{
/**
* The name and signature of the console command.
* @var string
*/
protected $signature = 'tags:create';
/**
* The console command description.
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
* @return int
*/
public function handle()
{
$tags = config('tags.tags');
foreach ($tags as $tag) {
$t = Tag::findOrCreate($tag['de'], 'search');
$t->icon = $tag['icon'];
$t->setTranslation('name', 'en', $tag['en']);
$t->save();
}
return Command::SUCCESS;
}
}