joshembling / image-optimizer

🎨 Optimize your Filament images before they reach your database.
https://filamentphp.com/plugins/joshembling-image-optimizer
MIT License
58 stars 14 forks source link

[Bug]: Trait "Filament\Forms\Components\Concerns\HasUploadingMessage" not found #12

Closed koyanyaroo closed 7 months ago

koyanyaroo commented 7 months ago

What happened?

When I tried to install the plugins to existing filament project using composer

composer require joshembling/image-optimizer

I've got error below

PHP Fatal error:  Trait "Filament\Forms\Components\Concerns\HasUploadingMessage" not found in /pathToProject/vendor/joshembling/image-optimizer/src/Components/BaseFileUpload.php on line 22

   Symfony\Component\ErrorHandler\Error\FatalError 

  Trait "Filament\Forms\Components\Concerns\HasUploadingMessage" not found

  at vendor/joshembling/image-optimizer/src/Components/BaseFileUpload.php:22
     18▕ use League\Flysystem\UnableToCheckFileExistence;
     19▕ use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
     20▕ use Throwable;
     21▕ 
  ➜  22▕ class BaseFileUpload extends Field
     23▕ {
     24▕     use Concerns\HasUploadingMessage;
     25▕ 
     26▕     /**

   Whoops\Exception\ErrorException 

  Trait "Filament\Forms\Components\Concerns\HasUploadingMessage" not found

  at vendor/joshembling/image-optimizer/src/Components/BaseFileUpload.php:22
     18▕ use League\Flysystem\UnableToCheckFileExistence;
     19▕ use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
     20▕ use Throwable;
     21▕ 
  ➜  22▕ class BaseFileUpload extends Field
     23▕ {
     24▕     use Concerns\HasUploadingMessage;
     25▕ 
     26▕     /**

      +1 vendor frames 

  2   [internal]:0
      Whoops\Run::handleShutdown()

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255

How to reproduce the bug

install the package from terminal to existing filament project

composer require joshembling/image-optimizer

Package Version

1.3.0

PHP Version

8.2.2

Laravel Version

10.43.0

Which operating systems does with happen with?

macOS

Notes

my composer.json

"require": {
        "php": "^8.1",
        "awcodes/filament-table-repeater": "^2.0",
        "awcodes/filament-tiptap-editor": "^3.0",
        "aymanalhattami/filament-page-with-sidebar": "^2.4",
        "bezhansalleh/filament-shield": "^3.1",
        "codewithdennis/filament-select-tree": "^3.1",
        "darryldecode/cart": "^4.2",
        "dasundev/livewire-dropzone": "^1.0",
        "eightynine/filament-excel-import": "^3.0",
        "erlandmuchasaj/laravel-gzip": "^1.0",
        "filament/filament": "^3.0-stable",
        "filament/spatie-laravel-media-library-plugin": "^3.0",
        "filament/spatie-laravel-settings-plugin": "^3.0",
        "filament/spatie-laravel-tags-plugin": "^3.0",
        "filament/spatie-laravel-translatable-plugin": "^3.0",
        "flowframe/laravel-trend": "^0.1.1",
        "guzzlehttp/guzzle": "^7.2",
        "jenssegers/agent": "^2.6",
        "joshembling/image-optimizer": "*",
        "laravel/framework": "^10.10",
        "laravel/horizon": "^5.21",
        "laravel/sanctum": "^3.2",
        "laravel/tinker": "^2.8",
        "laraveldaily/laravel-invoices": "^3.3",
        "league/flysystem-aws-s3-v3": "^3.21",
        "predis/predis": "^2.2",
        "pxlrbt/filament-excel": "^2.1",
        "ralphjsmit/livewire-urls": "^1.3",
        "saade/filament-adjacency-list": "^3.1",
        "sebastiansulinski/laravel-currency": "^3.2",
        "spatie/image": "^2.2",
        "squirephp/countries-en": "^3.3",
        "squirephp/currencies-en": "^3.3",
        "z3d0x/filament-fabricator": "^2.0",
        "z3d0x/filament-logger": "^0.6.1"
    },
koyanyaroo commented 7 months ago

is it meant to be HasLoadingMessage instead of HasUploadingMessage?

mateusgalasso commented 7 months ago

same error here

joshembling commented 7 months ago

Hi @koyanyaroo @mateusgalasso

For the latest version of Image Optimizer to work, you need to update your Filament version in your composer.json to "filament/filament": "^3.2".

If you do not want to update and are running an earlier version of Filament, please install "joshembling/image-optimizer": "1.2" and this should work with your Filament 3.0 & 3.1 versions.

I have updated the documentation here to help you further.

koyanyaroo commented 7 months ago

it works like a charm thank you @joshembling

joshembling commented 7 months ago

Thanks @koyanyaroo