📜  日期之间的 php laravel - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:18.697000             🧑  作者: Mango

代码示例2
namespace App\Http\Controllers;

use App\Mail\CheckUser;
use App\User;
use Carbon\Carbon;
use Illuminate\Http\Request;
use PDF;

class TestController extends Controller
{
    public function index()
    {   
       return view('welcome');
    }

    public function daily_report(Request $request)
    {
       $start_date = Carbon::parse($request->start_date)
                             ->toDateTimeString();

       $end_date = Carbon::parse($request->end_date)
                             ->toDateTimeString();

       return User::whereBetween('created_at', [
         $start_date, $end_date
       ])->get();
    }
}