PHP Array filter with min and max from dates

  arrays, laravel, php, search, sorting

I am trying to filter the records from min to max.

I have two nodes from where I want to filter one is min and other is max. Here is what i tried

I have two values to compare $request->min && $request->max . I don’t know what i am doing wrong.
Here is my PHP code that I tried:

        if ($request->max_date != null && $request->min_date != null) {
      foreach (json_decode($sTable->table_data) as $key => $st) {
        if ($st[0]->table_value == $request->min_date) {
        $html .= '<tr>';
        foreach ($st as $key => $d) {
            $html .= '<td>' . $d->table_value . '</td>';
        }
        $html .= '</tr>';
        if ($st[0]->table_value == $request->min_date) {

          return response()->json(['tbody' => $html], 200);

        }
      }
    }
  }

Source: Laravel

Leave a Reply