<?php

use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;

Route::group([
    'prefix'     => 'cms',
    'namespace'  => 'Api',
    'middleware' => config('api.route.middleware_guess'),
], function (Router $router) {
    $router->get('articles', 'ArticleController@index');
    $router->get('articles/{article}', 'ArticleController@show');

    $router->get('pages', 'PageController@index');
    $router->get('pages/secret', 'PageController@secret');
    $router->get('pages/protocol', 'PageController@protocol');
    $router->get('pages/{page}', 'PageController@show');

    $router->get('categories', 'CategoryController@index');
    $router->get('categories/{category}', 'CategoryController@show');

    $router->get('tags', 'TagController@index');
    $router->get('tags/{tag}', 'TagController@show');
});

Route::group([
    'prefix'     => 'cms',
    'namespace'  => 'Api',
    'middleware' => config('api.route.middleware_auth'),
], function (Router $router) {
    $router->get('articles/favorite/{article}', 'ArticleController@favorite');//收藏、取消收藏
    $router->get('articles/subscribe/{article}', 'ArticleController@subscribe');//点赞、取消点赞

});