You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
<?php
namespace App\Http\Controllers\Api;use App\Http\Controllers\Controller;use App\Models\Channel;use App\Models\UserChannel;
/** * 频道列表 * Class Channel * @package App\Http\Controllers\Api */class ChannelController extends Controller{ // 所有频道列表
public function index() { $list = Channel::query() ->where('agent_id', $this->agent_id) ->orderBy('sort') ->orderBy('id') ->get(['id', 'pid', 'name', 'icon']); return $this->success($list); }
// 我的频道
public function my() { $channel_ids = UserChannel::where('user_id', $this->user_id)->value('channels'); $list = Channel::whereIn('id', $channel_ids)->get(['id', 'pid', 'name', 'icon']); return $this->success($list); }}
|