accounts = $accounts; $this->classifier = new Classifier(); } /** * Execute the job. */ public function handle(): void { $classifier = $this->classifier; $accounts = $this->accounts; foreach($accounts as $acct) { Status::whereNotNull('caption') ->whereScope('public') ->whereProfileId($acct->id) ->inRandomOrder() ->take(400) ->pluck('caption') ->each(function($c) use ($classifier) { $classifier->learn($c, 'ham'); }); } Storage::put(AutospamService::MODEL_HAM_PATH, $classifier->export()); AutospamUpdateCachedDataPipeline::dispatch()->delay(5); } }