43 lines
944 B
PHP
43 lines
944 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Services\MagentoCategoryMigrationService;
|
|
use Illuminate\Http\Request;
|
|
|
|
class ConnectionsController extends Controller
|
|
{
|
|
protected $migrationService;
|
|
|
|
public function __construct(MagentoCategoryMigrationService $migrationService)
|
|
{
|
|
$this->migrationService = $migrationService;
|
|
}
|
|
|
|
/**
|
|
* Show the database connections page
|
|
*/
|
|
public function index()
|
|
{
|
|
$connectionTest = $this->migrationService->testConnections();
|
|
|
|
return view('connections.index', [
|
|
'connectionTest' => $connectionTest,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Test database connections
|
|
*/
|
|
public function testConnections()
|
|
{
|
|
$results = $this->migrationService->testConnections();
|
|
|
|
return response()->json([
|
|
'success' => $results['magento1'] && $results['magento2'],
|
|
'results' => $results,
|
|
]);
|
|
}
|
|
}
|
|
|