1$from = date('2018-01-01');
2$to = date('2018-05-02');
3
4Reservation::whereBetween('reservation_from', [$from, $to])->get();
1$from = date('2018-01-01');
2$to = date('2018-05-02');
3
4Reservation::whereBetween('reservation_from', [$from, $to])->get();
5
1namespace App\Http\Controllers;
2
3use App\Mail\CheckUser;
4use App\User;
5use Carbon\Carbon;
6use Illuminate\Http\Request;
7use PDF;
8
9class TestController extends Controller
10{
11 public function index()
12 {
13 return view('welcome');
14 }
15
16 public function daily_report(Request $request)
17 {
18 $start_date = Carbon::parse($request->start_date)
19 ->toDateTimeString();
20
21 $end_date = Carbon::parse($request->end_date)
22 ->toDateTimeString();
23
24 return User::whereBetween('created_at', [
25 $start_date, $end_date
26 ])->get();
27 }
28}
1// how to get dates between two dates in laravel?
2
3//NOTE => for this you can use Carbon
4use Carbon\CarbonPeriod;
5
6$period = CarbonPeriod::create("2020-5-20", "2020-5-30");
7foreach ($period as $date) {
8 // Insert Dates into listOfDates Array
9 $listOfDates[] = $date->format('Y-m-d');
10}
11
12// Now You Can Review This Array
13dd($listOfDates);
14