'desc'])->select(); if (empty($year_id)) { $year_id = $year_list[count($year_list) - 1]['id']; } return view('', [ 'year_list' => $year_list, 'year_id' => $year_id, ]); } public function list() { $month = input('month/d'); $year_id = input('year_id/d'); if (empty($month) || empty($year_id)) { return redirect(url('index')); } $previous = PreviousModel::where('status', ReservedModel::STATUS_SHOW) ->where('year_id', $year_id) ->where('month', $month) ->order(['priority' => 'desc', 'id' => 'desc']) ->select(); $previous = array_split($previous, 3); $year_list = PreviousYearModel::order(['priority' => 'desc'])->select(); return view('', [ 'previous' => $previous, 'year_list' => $year_list, 'year_id' => $year_id, 'month_index' => $month, 'month_list' => PreviousModel::MONTH, ]); } }