mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
Dashboard
This commit is contained in:
50
app/Http/Controllers/DashboardController.php
Normal file
50
app/Http/Controllers/DashboardController.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Http\Resources\TorrentResource;
|
||||
use App\Http\Resources\UserResource;
|
||||
use App\Repositories\DashboardRepository;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class DashboardController extends Controller
|
||||
{
|
||||
private $repository;
|
||||
|
||||
public function __construct(DashboardRepository $repository)
|
||||
{
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function systemInfo()
|
||||
{
|
||||
$result = $this->repository->getSystemInfo();
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
public function statData()
|
||||
{
|
||||
$result = $this->repository->getStatData();
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
public function latestUser()
|
||||
{
|
||||
$result = $this->repository->latestUser();
|
||||
$resource = UserResource::collection($result);
|
||||
$resource->additional([
|
||||
'page_title' => nexus_trans('dashboard.latest_user.page_title'),
|
||||
]);
|
||||
return $this->success($resource);
|
||||
}
|
||||
|
||||
public function latestTorrent()
|
||||
{
|
||||
$result = $this->repository->latestTorrent();
|
||||
$resource = TorrentResource::collection($result);
|
||||
$resource->additional([
|
||||
'page_title' => nexus_trans('dashboard.latest_torrent.page_title'),
|
||||
]);
|
||||
return $this->success($resource);
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,4 @@ class ToolController extends Controller
|
||||
$this->repository = $repository;
|
||||
}
|
||||
|
||||
public function systemInfo()
|
||||
{
|
||||
$result = $this->repository->getSystemInfo();
|
||||
return $this->success($result);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user