首页 > 代码库 > laravel按月/时间区间查询数据

laravel按月/时间区间查询数据

 public function payRollList($time)
    {
        $member_phone = Session::get(phone‘);
        $engineer = Engineer::getEngineerByPhone($member_phone);
        $start=date(‘Y-m-01‘,strtotime($time));//获取指定月份的第一天
        $end=date(‘Y-m-t‘,strtotime($time)); //获取指定月份的最后一天
        $repair=DB::table(‘order‘)
            ->where(‘repair_user‘,$engineer[‘member_id‘])
            ->where(‘order_status‘,1)
            ->whereBetween(‘create_time‘,[strtotime($start),strtotime($end)])
            ->where(‘status‘,0)
            ->orderBy(‘create_time‘, ‘desc‘)
            ->paginate($this->number);
        return view(‘home.engineer.payroll_order‘)->with(‘phone‘, $member_phone)->with(‘repair‘, $repair);
    }

 

laravel按月/时间区间查询数据