getModelType($this->argument('type')); $class::where('remove',1)->each(function($o) { foreach ($o->myduplicates()->get() as $oo) { if (! $oo->signature OR ! $oo->file_signature) continue; if ($oo->signature == $o->signature AND $oo->file_signature == $o->file_signature) { $this->info(sprintf('Removing: %s (%s)',$o->id,$o->filename)); // Dispatch Job to move file. switch (strtolower($this->argument('type'))) { case 'photo': $this->dispatch((new PhotoDelete($o))->onQueue('delete')); break; case 'video': $this->dispatch((new VideoDelete($o))->onQueue('delete')); break; default: $this->error('Dont know how to handle: ',$this->argument('type')); } } } }); } }