Files

35 lines
672 B
PHP
Executable File

<?php
namespace App\Console\Commands;
use App\Services\Media\Media;
use Illuminate\Console\Command;
use Illuminate\Support\Str;
class AddUUIDToMedia extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:add-uuid-to-media';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
public function handle()
{
Media::query()->cursor()->each(
fn(Media $media) => $media->update(['uuid' => Str::uuid()])
);
}
}