lundi 7 novembre 2016

Class not found in job with protected variable

I'm trying to create a Job, but when i set the line:

protected $param;

to pass the data from __construct to handle() I start getting this error:

Class not found

When I removed the protected $param; line, the Job works perfectly. But I'm not able to get the data. What can I do to fix this?

<?php

namespace App\Jobs;

use App\Jobs\Job;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;

use App\Repositories\ProductRepository;

class ImportProducts extends Job implements ShouldQueue
{
    use InteractsWithQueue, SerializesModels;

    protected $param;


    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($param)
    {
        $this->param = $param;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        //$products = $this->param['products'];
        exit();

    }
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire