<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                # 優化 ## 后臺 ### 文章加分類等條件篩選 ~~~php ... $grid->filter(function (Grid\Filter $filter) { $articleCategoryModel = new ArticleCategory(); // 更改為 panel 布局 $filter->panel(); // 展開過濾器 $filter->expand(); $filter->equal('id') ->width(1); $filter->like('title', '標題') ->width(2); $filter->equal('category_id', '類別') ->select($articleCategoryModel->selectOptions()) ->width(2); $filter->between('created_at', '添加時間') ->datetime() ->width(4); }); ... ~~~ ### 修改主頁內容 `app/Admin/Controllers/HomeController.php` ~~~php use App\Admin\Metrics\NewArticles; public function index(Content $content) { return $content ->header('儀表盤') ->description() ->body(function (Row $row) { $row->column(12, function (Column $column) { $column->row(function (Row $row) { $row->column(6, new NewArticles()); }); }); }); } ~~~ 卡片類文件 `app/Admin/Metrics/NewArticles.php` ~~~php use App\Models\Article; use Illuminate\Support\Carbon; protected function init() { parent::init(); $this->title('新增文章'); $this->dropdown([ '7' => '過去7天', '30' => '過去一個月', '365' => '過去一年', ]); } public function handle(Request $request) { switch ($request->get('option')) { case '365': $this->withContent(Article::whereBetween('created_at', [ Carbon::now() ->subDays(365), today() ]) ->count()); break; case '30': $this->withContent(Article::whereBetween('created_at', [ Carbon::now() ->subDays(30), today() ]) ->count()); break; case '7': default: $this->withContent(Article::whereBetween('created_at', [ Carbon::now() ->subDays(7), today() ]) ->count()); } } public function withChart(array $data) { return $this->chart([ 'series' => [ [ 'name' => $this->title, 'data' => $data, ], ], ]); } public function withContent($content) { return $this->content( <<<HTML <div class="d-flex justify-content-between align-items-center mt-1" style="margin-bottom: 2px"> <h2 class="ml-1 font-lg-1">{$content}</h2> <span class="mb-0 mr-1 text-80">{$this->title}</span> </div> HTML ); } ~~~ ## 前臺 ### 頁腳 頁腳的數據和頁眉不一致 修改 `app/Http/ViewComposers/ArticleCategoryComposer.php` ~~~php public function compose(View $view) { $articleCategoryModel = new ArticleCategory(); $nav = ArticleCategory::where('parent_id', 0) ->orderBy('order', 'desc') ->get(); //將文章和分類合并 并排序 if ($nav->isNotEmpty()) { foreach ($nav as $article_category) { $article_category->son = $articleCategoryModel->handle_category_data($article_category->articles, $article_category->children); } } $nav_foot = ArticleCategory::where('parent_id', 0) ->orderBy('order') ->get(); //將文章和分類合并 并排序 if ($nav_foot->isNotEmpty()) { foreach ($nav_foot as $article_category) { $articles_footer = $article_category->articles() ->where('is_footer', 1) ->get(); $article_category->son = $articleCategoryModel->handle_category_data($articles_footer, $article_category->children); } } $view->with(compact('nav', 'nav_foot')); } ~~~ 修改 `resources/views/index/layouts/_footer.blade.php` ~~~php ... @foreach($nav_foot as $category) ... @foreach($category->son as $item) ... @endforeach ... @endforeach ... ~~~ ### 去掉沒有用的代碼
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看