mirror of
https://github.com/Einundzwanzig-Podcast/einundzwanzig-portal.git
synced 2025-12-11 06:46:47 +00:00
tags creation added
This commit is contained in:
33
app/Console/Commands/Database/AddTagsToNewsArticles.php
Normal file
33
app/Console/Commands/Database/AddTagsToNewsArticles.php
Normal 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'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user