feat: Implement VM restart, auto-renew invoice functionality, and client invoice detail API, alongside admin UI improvements.

This commit is contained in:
pbao9
2026-03-02 10:26:01 +07:00
parent 2c8c3d14cd
commit 0c260a7e1c
9 changed files with 842 additions and 44 deletions
@@ -8,7 +8,8 @@ use App\Http\Requests\Api\Client\ClientRegisterRequest;
use App\Http\Requests\Api\Client\ClientUpdateRequest;
use App\Http\Resources\Api\Client\ClientResource;
use App\Services\Api\Client\ClientAuthService;
use Illuminate\Support\Facades\Auth;
use Tymon\JWTAuth\Facades\JWTAuth;
use Tymon\JWTAuth\Exceptions\JWTException;
/**
* @OA\Tag(
@@ -230,4 +231,25 @@ class ClientController extends Controller
],
]);
}
}
public function refresh()
{
try {
$newToken = JWTAuth::parseToken()->refresh();
$user = JWTAuth::setToken($newToken)->toUser();
return response()->json([
'error' => false,
'data' => [
'token' => $newToken,
'client' => new ClientResource($user),
],
]);
} catch (JWTException $e) {
return response()->json([
'error' => true,
'message' => 'Không thể làm mới phiên đăng nhập. Vui lòng đăng nhập lại.',
], 401);
}
}
}