我的一份工作 Laravel 有問題。(這是我第一次遇到這個問題,我有其他工作沒有問題......)我有一個監聽器在一個模型更新時調度工作,所以:一名模型觀察員(工作)觀察者發起的一項活動(工作)一個偵聽前一個事件的偵聽器(工作中)一個由聽眾派遣的工作(不工作......)作業已執行,但他轉到我數據庫中失敗的作業,并顯示錯誤“ErrorException: Undefined variable: ....” ...很奇怪,因為所有的變量都被定義了,為什么它兩次工作一次?如果有人對此有想法,我會接受:D提前致謝!工作代碼:<?phpnamespace App\Jobs;use Illuminate\Bus\Queueable;use Illuminate\Queue\SerializesModels;use Illuminate\Queue\InteractsWithQueue;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Foundation\Bus\Dispatchable;use App\Models\Transaction;use App\Repositories\TransactionRepository;use App\Repositories\InvoiceModelRepository;use App\Repositories\BalanceRepository;use Scheme;use Log;use Config;use App\Helpers\HelperNumber;use Symfony\Component\Console\Output\ConsoleOutput;/* sudo apt-get install supervisor https://laravel.com/docs/5.4/queues#supervisor-configuration php artisan queue:work --queue compute_fees --retry_after 30 --timeout 30*/class ComputeFees implements ShouldQueue{ use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; protected $id; /** * Create a new job instance. * * @param int $id * @return void */ public function __construct($id) { $this->id = $id; } /** * Get the best match of invoice models * * @param \App\Models\Transaction $transaction * @return \App\Models\InvoiceModel */ private function getFees($transaction) { $invoiceModelRepository = new InvoiceModelRepository(); //Get the fees for this site and payment type (And country if needed) $params = [ 'sites_id' => $transaction->site->id ]; return $params; }
Laravel 作業(隊列)不起作用
慕的地8271018
2021-11-05 14:37:38
