I'm trying to call a Job class that I created. But I'm getting this:
ReflectionException in Container.php line 734:
Class does not exist
at Job->failed() in SyncQueue.php line 153
at SyncQueue->handleFailedJob(object(SyncJob)) in SyncQueue.php line 36
at SyncQueue->push(object(ImportProductFromFile), '', 'upload_products_file') in Queue.php line 40
at Queue->pushOn('upload_products_file', object(ImportProductFromFile)) in Dispatcher.php line 135
at Dispatcher->pushCommandToQueue(object(SyncQueue), object(ImportProductFromFile))
This is my controller:
use App\Jobs\ImportProductFromFile;
class ProductController extends AppBaseController
{
public function importProducts(Request $request)
{
....
$param = array(
'products' => $products
);
$job = (new ImportProductFromFile($param))->onQueue('upload_products_file');
$this->dispatch($job);
}
}
The problem here is the handle function. When I handle the construct part, the file runs. And this is the ImportProductFromFile.php file:
namespace App\Jobs;
use App\Jobs\Job;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\DispatchesJobs;
use App\Repositories\ProductRepository;
use App\Models\Product;
use DB;
class ImportProductFromFile extends Job implements ShouldQueue
{
use InteractsWithQueue, SerializesModels;
use DispatchesJobs;
protected $param;
private $productRepository;
public function __construct($param)
{
$this->param = $param;
}
public function handle(ProductRepository $productRepo)
{
....
}
}