mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
[admin] filter improve & fix ad link
This commit is contained in:
@@ -9,6 +9,7 @@ use App\Models\Exam;
|
||||
use App\Repositories\ExamRepository;
|
||||
use App\Repositories\UserRepository;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Validation\Rule;
|
||||
|
||||
@@ -113,4 +114,11 @@ class ExamController extends Controller
|
||||
return $this->success($result);
|
||||
}
|
||||
|
||||
public function all()
|
||||
{
|
||||
$result = Exam::query()->orderBy('id', 'desc')->get();
|
||||
$resource = ExamResource::collection($result);
|
||||
return $this->success($resource);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ class TorrentController extends Controller
|
||||
$params = $request->all();
|
||||
$params['visible'] = Torrent::VISIBLE_YES;
|
||||
$params['category_mode'] = Setting::get('main.browsecat');
|
||||
$result = $this->repository->getList($params);
|
||||
$result = $this->repository->getList($params, Auth::user());
|
||||
$resource = TorrentResource::collection($result);
|
||||
$resource->additional([
|
||||
'page_title' => nexus_trans('torrent.index.page_title'),
|
||||
@@ -51,9 +51,8 @@ class TorrentController extends Controller
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$with = ['user', 'basic_audio_codec', 'basic_category', 'basic_codec', 'basic_media', 'basic_source', 'basic_standard', 'basic_team'];
|
||||
|
||||
$result = Torrent::query()->with($with)->withCount(['peers', 'thank_users'])->visible()->findOrFail($id);
|
||||
$result = $this->repository->getDetail($id, Auth::user());
|
||||
|
||||
$isBookmarked = Auth::user()->bookmarks()->where('torrentid', $id)->exists();
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@ class TorrentResource extends JsonResource
|
||||
'seeders' => $this->seeders,
|
||||
'times_completed' => $this->times_completed,
|
||||
'numfiles' => $this->numfiles,
|
||||
'download_url' => $this->download_url,
|
||||
'user' => new UserResource($this->whenLoaded('user')),
|
||||
'basic_category' => new CategoryResource($this->whenLoaded('basic_category')),
|
||||
];
|
||||
|
||||
@@ -28,7 +28,7 @@ class UserResource extends JsonResource
|
||||
'uploaded_text' => mksize($this->uploaded),
|
||||
'downloaded' => $this->downloaded,
|
||||
'downloaded_text' => mksize($this->downloaded),
|
||||
'seed_bonus' => $this->seedbonus,
|
||||
'bonus' => $this->seedbonus,
|
||||
'seed_points' => floatval($this->seed_points),
|
||||
'seedtime' => $this->seedtime,
|
||||
'seedtime_text' => mkprettytime($this->seedtime),
|
||||
|
||||
Reference in New Issue
Block a user