Browse Source

增加id字段调用

dev
李可松 4 years ago
parent
commit
e3450141e1
  1. 4
      app/Http/Controllers/Api/ChannelController.php

4
app/Http/Controllers/Api/ChannelController.php

@ -15,14 +15,14 @@ class ChannelController extends Controller
// 所有频道列表 // 所有频道列表
public function index() public function index()
{ {
$list = Channel::orderBy('sort')->orderBy('id', 'DESC')->get(['pid', 'name', 'icon']);
$list = Channel::orderBy('sort')->orderBy('id', 'DESC')->get(['id', 'pid', 'name', 'icon']);
return $this->success($list); return $this->success($list);
} }
// 我的频道 // 我的频道
public function my() public function my()
{ {
$channel_ids = UserChannel::where('uid', $this->user_id)->value('channels');
$channel_ids = UserChannel::where('user_id', $this->user_id)->value('channels');
$list = Channel::whereIn('id', $channel_ids)->get(['id', 'pid', 'name', 'icon']); $list = Channel::whereIn('id', $channel_ids)->get(['id', 'pid', 'name', 'icon']);
return $this->success($list); return $this->success($list);
} }

Loading…
Cancel
Save