o = $o->withoutRelations(); } public function middleware(): array { return [new WithoutOverlapping($this->uniqueId())]; } /** * Get the unique ID for the job. */ public function uniqueId(): string { return $this->o::config.'|'.$this->o->id; } /** * Execute the job. * * @return void * @throws \Exception */ public function handle() { $from = $this->o->file_name_rel(); $to = $this->o->file_name_rel(FALSE); Log::info(sprintf('%s: Moving [%s|%s] from [%s] to [%s]', __METHOD__, $this->o::config, $this->o->id, $from, $to, )); // If the move is successful, commit the transaction if ($this->o->isMoveable()) { // If our move fails, we'll abort the update DB::beginTransaction(); $this->o->filename = $this->o->file_name(); $this->o->save(); if (Storage::disk($this->o::fs)->move($from,$to)) DB::commit(); else Log::error(sprintf('%s: Move failed for file [%s]',__METHOD__,$from)); } else Log::alert(sprintf('%s: Unable to move file [%s] with reason [%s]', __METHOD__, $from, $this->o->isMoveableReason(), )); } }