I want to apply date range filter to my specific page .. There is just one date range picker which allows you to select a range from the calender and it shows in a single variable. i am getting the data in that variable but i dont know the exact way to filter my database data by splitting single variable value in two values ( from and to ) .

This is my input box --

```
<input type="text" class="form-control" name="daterange" value="01/01/2021 - 01/15/2021" />

```

Below is my specific script for daterange -

```
 $(function() {
            $('input[name="daterange"]').daterangepicker({
                "startDate": "11/01/2021",
                "endDate": "11/07/2021",
                opens: 'left'
            }, function(start, end, label) {
               console.log('New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')');
                axios.get('/fetchdata')
                    .then(response => {
                        data = this.form;
                    })
            });
        });

```

This is my web.php

```
Route::get('fetchdata', 'AccessoryController@fetch_data')->name('accessory.date.filter');

```

and this is my controller code where i need help , for now daterange picker is working. Its giving me correct selection in console. "New date range selected: 2021-11-04 to 2021-11-10 (predefined range: undefined)"

and my route is also working with return 'test' but i dont know how to get data at the back end.

```
 public function fetch_data(Request $request) 
   {
       //return 'test';
       return $request->all(); // This returns nothing
       $user = Auth::user();
       $storesID = $user->storesID->pluck('id');
       $stores = $user->stores;
       return $request->daterange;
       $accessory = AccessoryRequest::where('request_date', ">=", $request->startDate)->where('date', "<=", $request->endDate)->get(); //how can i filter
       return $accessory;
       return view('accessorydetails.index')
       ->with('stores', $stores)
       ->with('accessories', $accessories);
   }

```