<?php

namespace app\home\controller;

use app\common\model\PreviousModel;
use app\common\model\ReservedModel;
use app\home\HomeBaseController;

class Previous extends HomeBaseController
{
    public function index()
    {
        $same_month = date('n');
        $month      = input('month/d', $same_month);
        $previous   = PreviousModel::where('status', ReservedModel::STATUS_SHOW)
            ->where('month', $month)
            ->order(['priority' => 'desc', 'id' => 'desc'])
            ->select();
        $previous = array_split($previous,3);
        return view('', [
            'previous' => $previous,
            'month_list' => PreviousModel::MONTH,
            'month_index' => $month,
        ]);
    }

}
