laravel 按照时间筛选

        $start_time  = Carbon::now()->startOfDay();
        $end_time    = Carbon::now()->endOfDay();
        //今天开始
        $beginToday = date('Y-m-d 00:00:00', time());
        //今天结束
        $endToday = date('Y-m-d 23:59:59', time());
        //昨天开始
        $beginYesterday = date('Y-m-d 00:00:00', strtotime(' -1 day'));
        //昨天结束
        $endYesterday = date('Y-m-d 23:59:59', strtotime(' -1 day'));
'dailypriceYesterday' => function ($query) use ($beginYesterday, $endYesterday, $dataPermission) {
    $query->select(['id', 'table_id', 'price'])
        ->where('type', '1')
        ->whereBetWeen('pricedate', [$beginYesterday, $endYesterday])
        ->whereIn('create_by', $dataPermission);
},
已标记关键词 清除标记
©️2020 CSDN 皮肤主题: 游动-白 设计师:上身试试 返回首页