<?php
/**
 * Created by PhpStorm.
 * User: zilongs
 * Date: 20-10-5
 * Time: 上午11:28
 */

namespace App\Http\Controllers\Api\V1;

use App\Models\Suggest;

class SuggestController extends AuthController
{
    public function suggestList()
    {
        $user = $this->user;

        $data = Suggest::with(['suggestsDetail', 'order.docter'])->where('user_id', $user['id'])->orderBy('id', 'desc')->paginate();

        return out($data);
    }

    public function suggestDetail()
    {
        $req = request()->post();
        $this->validate(request(), [
            'suggest_id' => 'required|integer',
        ]);

        $data = Suggest::with(['suggestsDetail', 'order.docter'])->where('id', $req['suggest_id'])->first();

        return out($data);
    }
}
