tags creation added

This commit is contained in:
HolgerHatGarKeineNode
2023-03-17 13:36:59 +01:00
parent f87bf151da
commit d7ff201301
8 changed files with 220 additions and 34 deletions

View File

@@ -0,0 +1,33 @@
<?php
namespace App\Console\Commands\Database;
use App\Models\LibraryItem;
use Illuminate\Console\Command;
class AddTagsToNewsArticles extends Command
{
/**
* The name and signature of the console command.
* @var string
*/
protected $signature = 'news:tags';
/**
* The console command description.
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
public function handle(): void
{
LibraryItem::query()
->where('news', true)
->get()
->each(fn(LibraryItem $libraryItem) => $libraryItem->syncTagsWithType(['News'],
'library_item'));
}
}