Migration complete
This commit is contained in:
44
app/Console/Commands/MigrateTaxonomiesConfigure.php
Normal file
44
app/Console/Commands/MigrateTaxonomiesConfigure.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use Illuminate\Console\Attributes\Description;
|
||||
use Illuminate\Console\Attributes\Signature;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
#[Signature('migrate:taxonomies:configure')]
|
||||
#[Description('Configure taxonomies table.')]
|
||||
class MigrateTaxonomiesConfigure extends Command
|
||||
{
|
||||
|
||||
public function handle()
|
||||
{
|
||||
$taxonomyMap = [];
|
||||
$taxonomy = "a";
|
||||
$tableName = "";
|
||||
|
||||
while( $taxonomy !== "" ){
|
||||
$taxonomy = "";
|
||||
$tableName = "";
|
||||
|
||||
$taxonomy = $this->ask("Write WP taxonomy name. Write nothing if you want to save changes.", "" );
|
||||
if( $taxonomy == "" )
|
||||
break;
|
||||
|
||||
$tableName = $this->ask("Write equivalent Laravel table name.");
|
||||
|
||||
$taxonomyMap[$taxonomy] = $tableName;
|
||||
}
|
||||
|
||||
DB::table('migration_settings')
|
||||
->updateOrInsert([
|
||||
'key' => 'wp_taxonomies_to_laravel_tables'
|
||||
],[
|
||||
'value' => json_encode($taxonomyMap), 'updated_at' => now()
|
||||
]);
|
||||
|
||||
$this->info('WP Taxonomies to Laravel tables have been configured.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user