I'm trying to use query builder in controller using laravel, and i don't understand but the query didn't find the data.

Here's the code:

```
public function index()
{
    $data = downloads::all();

    if(request('searchName')){
        $data = $data->where('fileName','like','%'.request('searchName').'%'); //Here's the problem
        return view('download', compact('data'));
    }
    else{
        return view('download', compact('data'));
    }
}

```

i already tried `dd(request('searchName'))` and it display the input that i give, so there's no problem here

when I'm using `$data->where('fileName','like','%'.request('searchName').'%')` there's no data shown

i don't think that i misspell the fileName because when I'm using `$data->where('fileName','like',request('searchName'))` and it worked and display the file, but the fileName must be exactly the same as the inputed searchName, and of course what i wanted is not this

even when I'm using `dd('%'.request('searchName').'%');` it will display `"%*searchName*%"` that's why i so confused when it didn't work when I'm using `$data->where('fileName','like','%'.request('searchName').'%');`

I even using `SELECT * FROM *tables* WHERE fileName LIKE '%p%';` in SQL Workbench and it worked perfectly fine

Any suggestion of what should i do? Thank you