- Created ExampleTest and RoutesTest for basic application response and route testing. - Implemented IsolatedDatabaseTestCase for isolated database testing. - Added unit tests for various models and services including Contract, CPE, and LeadDetail. - Developed request validation tests for CreateClientRequest, UpdateClientRequest, and ContractRequest. - Introduced Vite configuration for asset management in the Laravel application.
37 lines
859 B
PHP
37 lines
859 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\AdminService;
|
|
use Illuminate\Http\Request;
|
|
|
|
class AdminController extends Controller
|
|
{
|
|
public function __construct(private AdminService $admin)
|
|
{
|
|
}
|
|
|
|
public function info()
|
|
{
|
|
return response()->json($this->admin->info());
|
|
}
|
|
|
|
public function phpInfo()
|
|
{
|
|
return response($this->admin->phpInfo())->header('Content-Type', 'text/html');
|
|
}
|
|
|
|
public function runMigrations()
|
|
{
|
|
$result = $this->admin->runMigrations();
|
|
return response()->json($result, $result['success'] ? 200 : 500);
|
|
}
|
|
|
|
public function testEmail(Request $request)
|
|
{
|
|
$data = $request->validate(['email' => 'required|email']);
|
|
return response()->json($this->admin->testEmail($data['email']));
|
|
}
|
|
}
|