Files
lucent-laravel/src/Commands/UpgradeFiles122.php
T

28 lines
759 B
PHP
Raw Normal View History

2024-09-27 16:27:37 +03:00
<?php
namespace Lucent\Commands;
use Illuminate\Console\Command;
use Lucent\Database\Database;
class UpgradeFiles122 extends Command
{
protected $signature = 'lucent:upgrade:files_1_2_2 {schema} {disk}';
protected $description = 'Upgrade to the new filesystem';
public function handle()
{
$schema = $this->argument('schema');
$disk = $this->argument('disk');
$db = Database::make();
$records = $db->table("records")->where("schema", $schema)->get();
foreach ($records as $record) {
$array = json_decode($record->_file, true);
$array["disk"] = $disk;
$db->table("records")->where("id", $record->id)->update(["_file" => json_encode($array)]);
}
}
}