mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-10-31 02:36:28 +00:00 
			
		
		
		
	Add imports for facades
This commit is contained in:
		| @@ -32,6 +32,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; | ||||
| use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; | ||||
| use Illuminate\Contracts\Encryption\DecryptException; | ||||
| use Illuminate\Support\Collection; | ||||
| use Illuminate\Support\Facades\Crypt; | ||||
| use Illuminate\Support\Facades\Storage; | ||||
| use League\Flysystem\UnableToDeleteFile; | ||||
| 
 | ||||
| @@ -73,7 +74,7 @@ class AttachmentRepository implements AttachmentRepositoryInterface, UserGroupIn | ||||
|             $encryptedContent = (string) $disk->get($file); | ||||
| 
 | ||||
|             try { | ||||
|                 $unencryptedContent = \Crypt::decrypt($encryptedContent); // verified
 | ||||
|                 $unencryptedContent = Crypt::decrypt($encryptedContent); // verified
 | ||||
|             } catch (DecryptException $e) { | ||||
|                 app('log')->debug(sprintf('Could not decrypt attachment #%d but this is fine: %s', $attachment->id, $e->getMessage())); | ||||
|                 $unencryptedContent = $encryptedContent; | ||||
|   | ||||
| @@ -45,6 +45,7 @@ use Illuminate\Pagination\LengthAwarePaginator; | ||||
| use Illuminate\Support\Collection; | ||||
| use Illuminate\Support\Facades\DB; | ||||
| use Illuminate\Support\Facades\Log; | ||||
| use Illuminate\Support\Facades\Storage; | ||||
| 
 | ||||
| /** | ||||
|  * Class BillRepository. | ||||
| @@ -161,9 +162,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface | ||||
|     public function getAttachments(Bill $bill): Collection | ||||
|     { | ||||
|         $set  = $bill->attachments()->get(); | ||||
| 
 | ||||
|         /** @var \Storage $disk */ | ||||
|         $disk = \Storage::disk('upload'); | ||||
|         $disk = Storage::disk('upload'); | ||||
| 
 | ||||
|         return $set->each( | ||||
|             static function (Attachment $attachment) use ($disk) {  // @phpstan-ignore-line
 | ||||
|   | ||||
| @@ -45,7 +45,9 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; | ||||
| use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; | ||||
| use Illuminate\Database\QueryException; | ||||
| use Illuminate\Support\Collection; | ||||
| use Illuminate\Support\Facades\DB; | ||||
| use Illuminate\Support\Facades\Log; | ||||
| use Illuminate\Support\Facades\Storage; | ||||
| 
 | ||||
| /** | ||||
|  * Class BudgetRepository. | ||||
| @@ -457,8 +459,8 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface | ||||
| 
 | ||||
|         /** @var Budget $budget */ | ||||
|         foreach ($budgets as $budget) { | ||||
|             \DB::table('budget_transaction')->where('budget_id', $budget->id)->delete(); | ||||
|             \DB::table('budget_transaction_journal')->where('budget_id', $budget->id)->delete(); | ||||
|             DB::table('budget_transaction')->where('budget_id', $budget->id)->delete(); | ||||
|             DB::table('budget_transaction_journal')->where('budget_id', $budget->id)->delete(); | ||||
|             RecurrenceTransactionMeta::where('name', 'budget_id')->where('value', (string) $budget->id)->delete(); | ||||
|             RuleAction::where('action_type', 'set_budget')->where('action_value', (string) $budget->id)->delete(); | ||||
|             $budget->delete(); | ||||
| @@ -530,8 +532,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface | ||||
|     { | ||||
|         $set  = $budget->attachments()->get(); | ||||
| 
 | ||||
|         /** @var \Storage $disk */ | ||||
|         $disk = \Storage::disk('upload'); | ||||
|         $disk = Storage::disk('upload'); | ||||
| 
 | ||||
|         return $set->each( | ||||
|             static function (Attachment $attachment) use ($disk) { // @phpstan-ignore-line
 | ||||
|   | ||||
| @@ -36,7 +36,9 @@ use FireflyIII\Services\Internal\Update\CategoryUpdateService; | ||||
| use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; | ||||
| use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; | ||||
| use Illuminate\Support\Collection; | ||||
| use Illuminate\Support\Facades\DB; | ||||
| use Illuminate\Support\Facades\Log; | ||||
| use Illuminate\Support\Facades\Storage; | ||||
| 
 | ||||
| /** | ||||
|  * Class CategoryRepository. | ||||
| @@ -83,8 +85,8 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf | ||||
| 
 | ||||
|         /** @var Category $category */ | ||||
|         foreach ($categories as $category) { | ||||
|             \DB::table('category_transaction')->where('category_id', $category->id)->delete(); | ||||
|             \DB::table('category_transaction_journal')->where('category_id', $category->id)->delete(); | ||||
|             DB::table('category_transaction')->where('category_id', $category->id)->delete(); | ||||
|             DB::table('category_transaction_journal')->where('category_id', $category->id)->delete(); | ||||
|             RecurrenceTransactionMeta::where('name', 'category_id')->where('value', $category->id)->delete(); | ||||
|             RuleAction::where('action_type', 'set_category')->where('action_value', $category->name)->delete(); | ||||
|             $category->delete(); | ||||
| @@ -237,8 +239,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf | ||||
|     { | ||||
|         $set  = $category->attachments()->get(); | ||||
| 
 | ||||
|         /** @var \Storage $disk */ | ||||
|         $disk = \Storage::disk('upload'); | ||||
|         $disk = Storage::disk('upload'); | ||||
| 
 | ||||
|         return $set->each( | ||||
|             static function (Attachment $attachment) use ($disk) { // @phpstan-ignore-line
 | ||||
|   | ||||
| @@ -32,6 +32,7 @@ use FireflyIII\Models\TransactionJournal; | ||||
| use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; | ||||
| use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; | ||||
| use Illuminate\Support\Collection; | ||||
| use Illuminate\Support\Facades\Storage; | ||||
| 
 | ||||
| /** | ||||
|  * Class JournalAPIRepository | ||||
| @@ -61,8 +62,7 @@ class JournalAPIRepository implements JournalAPIRepositoryInterface, UserGroupIn | ||||
|     { | ||||
|         $set  = $journal->attachments; | ||||
| 
 | ||||
|         /** @var \Storage $disk */ | ||||
|         $disk = \Storage::disk('upload'); | ||||
|         $disk = Storage::disk('upload'); | ||||
| 
 | ||||
|         return $set->each( | ||||
|             static function (Attachment $attachment) use ($disk) { | ||||
|   | ||||
| @@ -31,6 +31,7 @@ use FireflyIII\Support\CacheProperties; | ||||
| use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; | ||||
| use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; | ||||
| use Illuminate\Support\Collection; | ||||
| use Illuminate\Support\Facades\DB; | ||||
| 
 | ||||
| /** | ||||
|  * Class JournalCLIRepository | ||||
| @@ -180,7 +181,7 @@ class JournalCLIRepository implements JournalCLIRepositoryInterface, UserGroupIn | ||||
|         $query      = TransactionJournal::leftJoin('transactions', 'transaction_journals.id', '=', 'transactions.transaction_journal_id') | ||||
|             ->groupBy('transaction_journals.id') | ||||
|         ; | ||||
|         $result     = $query->get(['transaction_journals.id as id', \DB::raw('count(transactions.id) as transaction_count')]); // @phpstan-ignore-line
 | ||||
|         $result     = $query->get(['transaction_journals.id as id', DB::raw('count(transactions.id) as transaction_count')]); // @phpstan-ignore-line
 | ||||
|         $journalIds = []; | ||||
| 
 | ||||
|         /** @var \stdClass $row */ | ||||
|   | ||||
| @@ -29,6 +29,7 @@ use FireflyIII\Models\PiggyBank; | ||||
| use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; | ||||
| use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; | ||||
| use Illuminate\Support\Collection; | ||||
| use Illuminate\Support\Facades\DB; | ||||
| 
 | ||||
| /** | ||||
|  * Class ObjectGroupRepository | ||||
| @@ -64,7 +65,7 @@ class ObjectGroupRepository implements ObjectGroupRepositoryInterface, UserGroup | ||||
| 
 | ||||
|         /** @var ObjectGroup $group */ | ||||
|         foreach ($all as $group) { | ||||
|             $count = \DB::table('object_groupables')->where('object_groupables.object_group_id', $group->id)->count(); | ||||
|             $count = DB::table('object_groupables')->where('object_groupables.object_group_id', $group->id)->count(); | ||||
|             if (0 === $count) { | ||||
|                 $group->delete(); | ||||
|             } | ||||
|   | ||||
| @@ -40,6 +40,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; | ||||
| use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; | ||||
| use Illuminate\Support\Collection; | ||||
| use Illuminate\Support\Facades\Log; | ||||
| use Illuminate\Support\Facades\Storage; | ||||
| 
 | ||||
| /** | ||||
|  * Class PiggyBankRepository. | ||||
| @@ -111,8 +112,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte | ||||
|     { | ||||
|         $set  = $piggyBank->attachments()->get(); | ||||
| 
 | ||||
|         /** @var \Storage $disk */ | ||||
|         $disk = \Storage::disk('upload'); | ||||
|         $disk = Storage::disk('upload'); | ||||
| 
 | ||||
|         return $set->each( | ||||
|             static function (Attachment $attachment) use ($disk) { // @phpstan-ignore-line
 | ||||
|   | ||||
| @@ -34,7 +34,9 @@ use FireflyIII\Models\Tag; | ||||
| use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; | ||||
| use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; | ||||
| use Illuminate\Support\Collection; | ||||
| use Illuminate\Support\Facades\DB; | ||||
| use Illuminate\Support\Facades\Log; | ||||
| use Illuminate\Support\Facades\Storage; | ||||
| 
 | ||||
| /** | ||||
|  * Class TagRepository. | ||||
| @@ -53,7 +55,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface | ||||
|      */ | ||||
|     public function destroy(Tag $tag): bool | ||||
|     { | ||||
|         \DB::table('tag_transaction_journal')->where('tag_id', $tag->id)->delete(); | ||||
|         DB::table('tag_transaction_journal')->where('tag_id', $tag->id)->delete(); | ||||
|         $tag->transactionJournals()->sync([]); | ||||
|         $tag->delete(); | ||||
| 
 | ||||
| @@ -70,7 +72,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface | ||||
| 
 | ||||
|         /** @var Tag $tag */ | ||||
|         foreach ($tags as $tag) { | ||||
|             \DB::table('tag_transaction_journal')->where('tag_id', $tag->id)->delete(); | ||||
|             DB::table('tag_transaction_journal')->where('tag_id', $tag->id)->delete(); | ||||
|             $tag->delete(); | ||||
|         } | ||||
|     } | ||||
| @@ -112,9 +114,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface | ||||
|     public function getAttachments(Tag $tag): Collection | ||||
|     { | ||||
|         $set  = $tag->attachments()->get(); | ||||
| 
 | ||||
|         /** @var \Storage $disk */ | ||||
|         $disk = \Storage::disk('upload'); | ||||
|         $disk = Storage::disk('upload'); | ||||
| 
 | ||||
|         return $set->each( | ||||
|             static function (Attachment $attachment) use ($disk): void { // @phpstan-ignore-line
 | ||||
|   | ||||
| @@ -47,6 +47,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface; | ||||
| use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait; | ||||
| use Illuminate\Database\Eloquent\Builder; | ||||
| use Illuminate\Support\Collection; | ||||
| use Illuminate\Support\Facades\DB; | ||||
| 
 | ||||
| /** | ||||
|  * Class TransactionGroupRepository | ||||
| @@ -294,7 +295,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, | ||||
|      */ | ||||
|     public function getMetaDateFields(int $journalId, array $fields): NullArrayObject | ||||
|     { | ||||
|         $query  = \DB::table('journal_meta') | ||||
|         $query  = DB::table('journal_meta') | ||||
|             ->where('transaction_journal_id', $journalId) | ||||
|             ->whereIn('name', $fields) | ||||
|             ->whereNull('deleted_at') | ||||
| @@ -314,7 +315,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, | ||||
|      */ | ||||
|     public function getMetaFields(int $journalId, array $fields): NullArrayObject | ||||
|     { | ||||
|         $query  = \DB::table('journal_meta') | ||||
|         $query  = DB::table('journal_meta') | ||||
|             ->where('transaction_journal_id', $journalId) | ||||
|             ->whereIn('name', $fields) | ||||
|             ->whereNull('deleted_at') | ||||
| @@ -383,7 +384,7 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface, | ||||
|      */ | ||||
|     public function getTags(int $journalId): array | ||||
|     { | ||||
|         $result = \DB::table('tag_transaction_journal') | ||||
|         $result = DB::table('tag_transaction_journal') | ||||
|             ->leftJoin('tags', 'tag_transaction_journal.tag_id', '=', 'tags.id') | ||||
|             ->where('tag_transaction_journal.transaction_journal_id', $journalId) | ||||
|             ->orderBy('tags.tag', 'ASC') | ||||
|   | ||||
		Reference in New Issue
	
	Block a user