mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-24 12:07:23 +08:00
[api] message order by id desc
This commit is contained in:
@@ -18,7 +18,11 @@ class MessageController extends Controller
|
|||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
$user = Auth::user();
|
$user = Auth::user();
|
||||||
$messages = Message::query()->where('receiver', $user->id)->with(['send_user'])->paginate();
|
$messages = Message::query()
|
||||||
|
->where('receiver', $user->id)
|
||||||
|
->with(['send_user'])
|
||||||
|
->orderBy('id', 'desc')
|
||||||
|
->paginate();
|
||||||
$resource = MessageResource::collection($messages);
|
$resource = MessageResource::collection($messages);
|
||||||
return $this->success($resource);
|
return $this->success($resource);
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,8 @@ class TorrentResource extends JsonResource
|
|||||||
'user' => new UserResource($this->whenLoaded('user')),
|
'user' => new UserResource($this->whenLoaded('user')),
|
||||||
'basic_category' => new CategoryResource($this->whenLoaded('basic_category')),
|
'basic_category' => new CategoryResource($this->whenLoaded('basic_category')),
|
||||||
];
|
];
|
||||||
|
$descriptionArr = format_description($this->descr);
|
||||||
|
$out['cover'] = get_image_from_description($descriptionArr, true);
|
||||||
if ($request->routeIs('torrents.show')) {
|
if ($request->routeIs('torrents.show')) {
|
||||||
$baseInfo = [
|
$baseInfo = [
|
||||||
['label' => nexus_trans('torrent.show.size'), 'value' => mksize($this->size)],
|
['label' => nexus_trans('torrent.show.size'), 'value' => mksize($this->size)],
|
||||||
@@ -47,7 +48,7 @@ class TorrentResource extends JsonResource
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$out['base_info'] = $baseInfo;
|
$out['base_info'] = $baseInfo;
|
||||||
$descriptionArr = format_description($this->descr);
|
|
||||||
$out['description'] = $descriptionArr;
|
$out['description'] = $descriptionArr;
|
||||||
|
|
||||||
$out['images'] = get_image_from_description($descriptionArr);
|
$out['images'] = get_image_from_description($descriptionArr);
|
||||||
@@ -55,8 +56,6 @@ class TorrentResource extends JsonResource
|
|||||||
$out['thank_users_count'] = $this->thank_users_count;
|
$out['thank_users_count'] = $this->thank_users_count;
|
||||||
$out['peers_count'] = $this->peers_count;
|
$out['peers_count'] = $this->peers_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
$out['cover'] = get_image_from_description(format_description($this->descr), true);
|
|
||||||
// $out['upload_peers_count'] = $this->upload_peers_count;
|
// $out['upload_peers_count'] = $this->upload_peers_count;
|
||||||
// $out['download_peers_count'] = $this->download_peers_count;
|
// $out['download_peers_count'] = $this->download_peers_count;
|
||||||
// $out['finish_peers_count'] = $this->finish_peers_count;
|
// $out['finish_peers_count'] = $this->finish_peers_count;
|
||||||
|
|||||||
Reference in New Issue
Block a user