'docx', self::DOCXOLD_MIME_TYPE => 'docx', self::DOCX_WPS_TYPE => 'docx', self::DOC_MIME_TYPE => 'doc', self::RTF_MIME_TYPE => 'rtf', self::APPLICATION_RTF_MIME_TYPE => 'rtf', self::ODT_MIME_TYPE => 'odt', self::PDF_MIME_TYPE => 'pdf', self::PDF_WPS_MIME_TYPE => 'pdf', self::PLAIN_TEXT_TYPE => 'txt', ]; public function __construct($id, $document) { $this->id = $id; $this->document = $document; } public function handle() { $storage = Storage::disk('local'); $file = request()->file('document'); $mimeType = $file->getClientMimeType(); if (!array_key_exists($mimeType, $this->supportedFiles)) { throw new \Exception('File not supported.'); } $type = $this->supportedFiles[$mimeType]; $path = $storage->putFileAs("contracts", $file, "$this->id.$type"); IngestDocuments::dispatch($path, $type); } }