Files
ProxyPanel/app/Http/Controllers/User/ArticleController.php
BrettonYe ad3662cda0 🚀 Refactor Blade
- Optimize Blade JavaScript code.
- Refactored multiple admin controllers for improved validation, error handling, and query efficiency.
- Added ProxyConfig trait to centralize proxy configuration options.
- Updated NodeStatusDetection to use model relationships for heartbeat checks.
- Improved category, label, and country management logic and error logging.
- Added new Blade components for admin UI and updated language files and assets for better localization and frontend support.
- Bug fixed & introduced more bug :)
2026-01-30 20:04:17 +08:00

31 lines
954 B
PHP

<?php
namespace App\Http\Controllers\User;
use App\Http\Controllers\Controller;
use App\Models\Article;
use App\Services\ArticleService;
use App\Services\NodeService;
use Illuminate\Contracts\View\View;
use Illuminate\Http\JsonResponse;
class ArticleController extends Controller
{
public function index(NodeService $nodeService): View
{ // 帮助中心
$user = auth()->user();
return view('user.knowledge', [
'subType' => $nodeService->getActiveNodeTypes(),
'subUrl' => $user->sub_url,
'subscribe' => $user->subscribe->only(['status', 'ban_desc']),
'knowledge' => Article::type(1)->lang()->orderByDesc('sort')->latest()->get()->groupBy('category'),
]);
}
public function show(Article $article): JsonResponse
{ // 文章详情
return response()->json(['title' => $article->title, 'content' => (new ArticleService($article))->getContent()]);
}
}