RickDBCN / filament-email

Log emails in your Filament project
https://filament-email-demo.marcogermani.it/
MIT License
75 stars 21 forks source link

[Bug]: Call to undefined method Illuminate\Database\Eloquent\Builder::filter() when searching #68

Closed Jacobtims closed 2 weeks ago

Jacobtims commented 1 month ago

What happened?

When I try to search for records on the Email Logs page and I type in a search query. I get the following error:

Call to undefined method Illuminate\Database\Eloquent\Builder::filter()

How to reproduce the bug

  1. Install the package
  2. Make sure there is at least 1 email log
  3. Type in a search query in the search field

Package Version

1.4.8

PHP Version

8.2.20

Laravel Version

10.48.15

Which operating systems does with happen with?

macOS, Linux

Notes

No response

RickDBCN commented 1 month ago

Hi Jacob,

Sorry for the inconvenience. Did you experience the same issues on the previous version (1.4.7)?

Jacobtims commented 1 month ago

I just tried it and it gives me the exact same error when searching

RickDBCN commented 1 month ago

For search, we are using the default ->searchable option that Filament has to offer. Are you able to search in any of your other resources? What filament version are you using?

marcogermani87 commented 1 month ago

For search, we are using the default ->searchable option that Filament has to offer. Are you able to search in any of your other resources? What filament version are you using?

I think the problem is here:

src/Filament/Resources/EmailResource/Pages/ListEmails.php

  protected function applySearchToTableQuery(Builder $query): Builder
  {
      if (filled($searchQuery = $this->getTableSearch())) {
          return $query->filter(['search' => $searchQuery]);
      }

      return $query;
  }

We can write a Pest scenario for testing searchable method with all env.

marcogermani87 commented 1 month ago

Hi @Jacobtims,

i've tried the v1.4.8 on a demo instance with this specs and all is ok:

Environment ..................................................................................
Laravel Version ............................................................................. 10.48.16
PHP Version ................................................................................... 8.3.6
Composer Version ...................................................................... 2.7.5
Environment .................................................................................. local
Debug Mode ................................................................................. ENABLED
Maintenance Mode ..................................................................... OFF

Cache ................................................................................................
Config .................................................................................. NOT CACHED
Events .................................................................................... NOT CACHED
Routes ..................................................................................... NOT CACHED
Views ..................................................................................... CACHED

Drivers ..............................................................................................
Broadcasting ............................................................................ log
Cache .......................................................................................... memcached
Database .................................................................................... mysql
Logs ............................................................................................ daily
Mail .............................................................................................smtp
Octane ....................................................................................... roadrunner
Queue ........................................................................................ sync
Session ....................................................................................... redis

Filament ..........................................................................................
Packages ...........................................filament, forms, notifications, support, tables
Version ............................................................................... v3.2.95
Views ...................................................................................NOT PUBLISHED

Livewire ..........................................................................................
Livewire ........................................................................................... v3.5.4

Spatie Permissions .........................................................................
Features Enabled .................................................................... Default
Version ....................................................................................... 6.9.0

You can share the output for "php artisan about" command?

marcogermani87 commented 2 weeks ago

Close as stale