<?php

namespace App\Http\Controllers\Api;

use App\News;

class NewsController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return array
     */
    public function index()
    {
        $news = News::query()->get()->toArray();

        return $this->ok($news);
    }

    /**
     * 查看帖子详情
     * @param $id
     * @return array
     */
    public function show($id)
    {
        $news = News::query()->find($id);

        return $this->ok($news->toArray());
    }
}
