Files
hub/app/Console/Commands/ExploreRemoteDatabase.php
kelly 84e81272a5 feat: Product and inventory management system with media improvements
- Complete product and inventory management system
- Media storage service with proper path conventions
- Image handling with dynamic resizing
- Database migrations for inventory tracking
- Import tools for legacy data migration
- Documentation improvements

- InventoryItem, InventoryMovement, InventoryAlert models with hashid support
- Purchase order tracking on inventory alerts
- Inventory dashboard for sellers
- Stock level monitoring and notifications

- MediaStorageService enforcing consistent path conventions
- Image controller with dynamic resizing capabilities
- Migration tools for moving images to MinIO
- Proper slug-based paths (not IDs or hashids)

- ImportProductsFromRemote command
- ImportAlohaSales, ImportThunderBudBulk commands
- ExploreRemoteDatabase for schema inspection
- Legacy data migration utilities

- Product variations table
- Remote customer mappings
- Performance indexes for stats queries
- Social media fields for brands
- Module flags for businesses

- New migrations for inventory, hashids, performance indexes
- New services: MediaStorageService
- New middleware: EnsureBusinessHasModule, EnsureUserHasCapability
- Import commands for legacy data
- Inventory models and controllers
- Updated views for marketplace and seller areas
- Documentation reorganization (archived old docs)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 18:40:54 -07:00

92 lines
2.9 KiB
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class ExploreRemoteDatabase extends Command
{
protected $signature = 'explore:remote-db {query?}';
protected $description = 'Explore the remote MySQL database';
public function handle()
{
// Configure remote MySQL connection
config(['database.connections.remote_mysql' => [
'driver' => 'mysql',
'host' => 'sql1.creationshop.net',
'port' => '3306',
'database' => 'hub_cannabrands',
'username' => 'claude',
'password' => 'claude',
'charset' => 'utf8mb4',
'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
]]);
$this->info('✓ Connected to remote MySQL database');
$this->newLine();
// Show brands table structure
$this->info('=== BRANDS TABLE STRUCTURE ===');
$columns = DB::connection('remote_mysql')->select('DESCRIBE brands');
foreach ($columns as $column) {
$this->line(" {$column->Field} ({$column->Type})");
}
$this->newLine();
// Show first 5 brands
$this->info('=== BRANDS ===');
$brands = DB::connection('remote_mysql')->table('brands')->limit(5)->get();
foreach ($brands as $brand) {
$this->line(json_encode($brand, JSON_PRETTY_PRINT));
$this->line('---');
}
$this->newLine();
// Show products table structure
$this->info('=== PRODUCTS TABLE ===');
$this->line('Sample products with SKU codes:');
$products = DB::connection('remote_mysql')
->table('products')
->select('id', 'brand_id', 'name', 'code', 'barcode', 'wholesale_price', 'cost', 'quantity')
->where('active', 1)
->whereNotNull('code')
->limit(10)
->get();
foreach ($products as $product) {
$this->line(json_encode($product, JSON_PRETTY_PRINT));
}
$this->newLine();
// Show orders table structure
$this->info('=== ORDERS & ORDER_PRODUCTS ===');
$orderSample = DB::connection('remote_mysql')
->table('order_products')
->join('orders', 'orders.id', '=', 'order_products.order_id')
->join('products', 'products.id', '=', 'order_products.product_id')
->select(
'orders.id as order_id',
'orders.created_at',
'products.code as sku',
'products.name',
'order_products.quantity',
'order_products.price',
'order_products.subtotal'
)
->limit(5)
->get();
foreach ($orderSample as $order) {
$this->line(json_encode($order, JSON_PRETTY_PRINT));
}
return 0;
}
}