mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Update packages and various code for laravel 9
This commit is contained in:
@@ -31,7 +31,6 @@ use FireflyIII\Models\Attachment;
|
||||
use FireflyIII\Models\Note;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Contracts\Encryption\DecryptException;
|
||||
use Illuminate\Contracts\Filesystem\FileNotFoundException;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Log;
|
||||
@@ -101,12 +100,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface
|
||||
$unencryptedContent = '';
|
||||
|
||||
if ($disk->exists($file)) {
|
||||
$encryptedContent = '';
|
||||
try {
|
||||
$encryptedContent = $disk->get($file);
|
||||
} catch (FileNotFoundException $e) {
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
$encryptedContent = (string) $disk->get($file);
|
||||
|
||||
try {
|
||||
$unencryptedContent = Crypt::decrypt($encryptedContent); // verified
|
||||
@@ -129,7 +123,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface
|
||||
{
|
||||
$note = $attachment->notes()->first();
|
||||
if (null !== $note) {
|
||||
return (string)$note->text;
|
||||
return (string) $note->text;
|
||||
}
|
||||
|
||||
return null;
|
||||
@@ -175,20 +169,20 @@ class AttachmentRepository implements AttachmentRepositoryInterface
|
||||
$attachment->title = $data['title'];
|
||||
}
|
||||
|
||||
if (array_key_exists('filename', $data) && '' !== (string)$data['filename'] && $data['filename'] !== $attachment->filename) {
|
||||
if (array_key_exists('filename', $data) && '' !== (string) $data['filename'] && $data['filename'] !== $attachment->filename) {
|
||||
$attachment->filename = $data['filename'];
|
||||
}
|
||||
// update model (move attachment)
|
||||
// should be validated already:
|
||||
if (array_key_exists('attachable_type', $data) && array_key_exists('attachable_id', $data)) {
|
||||
$attachment->attachable_id = (int)$data['attachable_id'];
|
||||
$attachment->attachable_id = (int) $data['attachable_id'];
|
||||
$attachment->attachable_type = sprintf('FireflyIII\\Models\\%s', $data['attachable_type']);
|
||||
}
|
||||
|
||||
$attachment->save();
|
||||
$attachment->refresh();
|
||||
if (array_key_exists('notes', $data)) {
|
||||
$this->updateNote($attachment, (string)$data['notes']);
|
||||
$this->updateNote($attachment, (string) $data['notes']);
|
||||
}
|
||||
|
||||
return $attachment;
|
||||
|
Reference in New Issue
Block a user