0

I need to output only those users who fall into the conditions. For example, if Yes, two dates from (01.01.2020) to (06.01.2020) and all users whose date is in this interval were displayed on the screen

In my controller I'm doing this:

$data_ot = $request->input('data_ot');
$data_do = $request->input('data_do');
$othet = Othet::where('data_start',$data_do,'=>',$data_ot)->get();
Florian
  • 2,796
  • 1
  • 15
  • 25
v43523
  • 5
  • 2

3 Answers3

1

You can use between:

$othet = Othet::whereBetween('data_start', [$data_ot, $data_do])->get();
SergkeiM
  • 3,934
  • 6
  • 36
  • 69
1

You can use whereBetween method for this -

$othet = Othet::whereBetween('data_start', [$data_ot, $data_do])->get();
Hitesh Kumar
  • 383
  • 2
  • 6
0

You can use:

$othet = Othet::where('data_start','>=' $data_do)
               ->where('date_start', '<=',$data_ot)
               ->get();

Of course this is just example - I don't know what exact values those variables hold.

Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291