第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Laravel - 航海者管理調(diào)光器統(tǒng)計

Laravel - 航海者管理調(diào)光器統(tǒng)計

PHP
暮色呼如 2022-10-28 14:19:09
我有 voyager 管理面板的 laravel 項目?,F(xiàn)在我需要在我的管理儀表板上查看商店中產(chǎn)品的統(tǒng)計數(shù)據(jù),但僅限于今天。所以它需要向我展示今天生產(chǎn)的所有產(chǎn)品,計算它并在我的儀表板上顯示它。讓我展示我的代碼:這是我的DeltaDimmer.php:<?phpnamespace TCG\Voyager\Widgets;use Illuminate\Support\Facades\Auth;use Illuminate\Support\Str;use TCG\Voyager\Facades\Voyager;use Carbon\Carbon;use App\Storeone;class DeltaDimmer extends BaseDimmer{    /**     * The configuration array.     *     * @var array     */    protected $config = [];    /**     * Treat this method as a controller action.     * Return view() or other content to display.     */    public function run()    {        $count = Storeone::where('created_at', '=', Carbon::today())->count();        //$count = \App\Storeone::where('created_at', '=', Carbon::today())->count();        $string = 'Rad: ';        return view('voyager::dimmer', array_merge($this->config, [            'icon'   => 'voyager-eye',            'title'  => "{$string} {$count}",            'text'   => 'Optika Podgorica/Delta',            'button' => [                'text' => 'Prikazi',                'link' => route('voyager.optikadelta.index'),            ],            'image' => voyager_asset('images/widget-backgrounds/04.jpeg'),        ]));    }    /**     * Determine if the widget should be displayed.     *     * @return bool     */    public function shouldBeDisplayed()    {        return Auth::user()->can('browse', Voyager::model('Post'));    }}所以這是我的DeltaDimmer.php。這條線$count = Storeone::where('created_at', '=', Carbon::today())->count();應(yīng)該Storeone只計算我今天的產(chǎn)品,但現(xiàn)在它顯示為 0,我制作了一些產(chǎn)品只是為了測試。我做錯了什么?
查看完整描述

1 回答

?
aluckdog

TA貢獻1847條經(jīng)驗 獲得超7個贊

使用whereDate而不是僅與比較where

$count = Storeone::whereDate('created_at', Carbon::today())->count();


查看完整回答
反對 回復(fù) 2022-10-28
  • 1 回答
  • 0 關(guān)注
  • 106 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號