Describe the bug
When eager loading is enabled, scout:import fails on the horizon queue.
To Reproduce
Steps to reproduce the behavior:
Run a command 'php artisan scout:import App\Post'
Error: The script tried to call a method on an incomplete object. Please ensure that the class definition "App\Services\WithPostsScope" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:163
Expected behavior
To use horizon queue to import my model.
Additional context
Only appears to fail when queuing the import.
Describe the bug When eager loading is enabled, scout:import fails on the horizon queue.
To Reproduce Steps to reproduce the behavior:
Error: The script tried to call a method on an incomplete object. Please ensure that the class definition "App\Services\WithPostsScope" of the object you are trying to operate on was loaded _before_ unserialize() gets called or provide an autoloader to load the class definition in /app/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Builder.php:163
Expected behavior To use horizon queue to import my model.
Additional context Only appears to fail when queuing the import.
Version This package version: 5.0.2
Laravel Framework 9.10.1 Laravel Scout 9.4.7 Laravel Horizon 5.9