<?php


namespace App\Repositories;

use App\Services\TencentImMessage;
use Dcat\Admin\Grid;
use Dcat\Admin\Repositories\Repository;
use Illuminate\Pagination\LengthAwarePaginator;
use App\Models\FeedComment as FeedCommentModel;
class FeedComment extends Repository
{
    public $feed_id;
    public function __construct($id)
    {
        $this->feed_id = $id;
    }

    /**
     * 查询表格数据
     *
     * @param Grid\Model $model
     * @return LengthAwarePaginator
     */
    public function get(Grid\Model $model)
    {
        $currentPage = $model->getCurrentPage();
        $perPage = $model->getPerPage();

        $data =FeedCommentModel::query()
            ->where(['feed_id'=>$this->feed_id])
//            ->where($model->filter())
            ->with(['user:id,name,avatar','to_user:id,name,avatar'])
            ->paginate();

        return $data;
        return $model->makePaginator($res['MsgCnt'],$res['MsgList']);
    }
}
