diff --git a/.php_cs.cache b/.php_cs.cache index c95243cd..cbfdd60e 100644 --- a/.php_cs.cache +++ b/.php_cs.cache @@ -1 +1 @@ -{"php":"7.4.12","version":"2.18.6:v2.18.6#5fed214993e7863cef88a08f214344891299b9e4","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"ordered_imports":{"sortAlgorithm":"length"},"blank_line_before_statement":{"statements":["break","case","continue","declare","default","die","do","exit","for","foreach","goto","if","include","include_once","require","require_once","return","switch","throw","try","while","yield","yield_from"]},"class_attributes_separation":{"elements":["method"]},"no_extra_blank_lines":["break","case","continue","curly_brace_block","default","extra","parenthesis_brace_block","return","square_brace_block","switch","throw","use","useTrait","use_trait"],"cast_spaces":{"space":"single"},"phpdoc_single_line_var_spacing":true,"phpdoc_var_without_name":true,"single_space_after_construct":true,"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline_array":true,"phpdoc_scalar":true,"unary_operator_spaces":true,"binary_operator_spaces":true,"no_spaces_around_offset":true,"method_chaining_indentation":true,"array_indentation":true,"single_quote":true,"no_singleline_whitespace_before_semicolons":true,"no_empty_statement":true,"standardize_increment":true,"object_operator_without_whitespace":true,"ternary_operator_spaces":true,"no_leading_namespace_whitespace":true,"no_blank_lines_before_namespace":true,"fully_qualified_strict_types":true,"single_line_throw":true,"function_typehint_space":true,"simplified_if_return":true,"no_useless_else":true,"no_unneeded_curly_braces":true,"no_empty_comment":true,"no_blank_lines_after_class_opening":true,"whitespace_after_comma_in_array":true,"trim_array_spaces":true,"no_whitespace_before_comma_in_array":true,"lowercase_static_reference":true},"hashes":{"app\/Providers\/AppServiceProvider.php":2241922344,"app\/Providers\/FortifyServiceProvider.php":4138315837,"app\/Providers\/AuthServiceProvider.php":169859517,"app\/Providers\/RouteServiceProvider.php":1824013481,"app\/Providers\/BroadcastServiceProvider.php":3541093703,"app\/Providers\/EventServiceProvider.php":3395009334,"app\/Models\/LanguageTranslation.php":1555765712,"app\/Models\/Zip.php":2771946819,"app\/Models\/File.php":740654951,"app\/Models\/User.php":2163572064,"app\/Models\/Folder.php":1298633099,"app\/Models\/Invoice.php":3022282710,"app\/Models\/UserSettings.php":3400206961,"app\/Models\/Traffic.php":2512673789,"app\/Models\/Share.php":385526656,"app\/Models\/Language.php":1756684391,"app\/Models\/Page.php":1640698967,"app\/Models\/Setting.php":3917536845,"app\/Exceptions\/Handler.php":1302274777,"app\/Http\/Middleware\/VerifyCsrfToken.php":2876451146,"app\/Http\/Middleware\/RedirectIfAuthenticated.php":4037446582,"app\/Http\/Middleware\/TrimStrings.php":10633912,"app\/Http\/Middleware\/Authenticate.php":829439188,"app\/Http\/Middleware\/TrustProxies.php":3573151230,"app\/Http\/Middleware\/CheckForMaintenanceMode.php":3053801562,"app\/Http\/Middleware\/PreventRequestsDuringMaintenance.php":2280943271,"app\/Http\/Middleware\/EncryptCookies.php":1502216959,"app\/Http\/Mail\/SendContactMessage.php":387870296,"app\/Http\/Resources\/LanguageCollection.php":1364645788,"app\/Http\/Resources\/FileResource.php":2500497589,"app\/Http\/Resources\/PricingCollection.php":549452717,"app\/Http\/Resources\/PageCollection.php":842383211,"app\/Http\/Resources\/InvoiceAdminCollection.php":274747241,"app\/Http\/Resources\/PricingResource.php":2786525720,"app\/Http\/Resources\/PaymentDefaultCardResource.php":1710261108,"app\/Http\/Resources\/LanguageResource.php":1673048322,"app\/Http\/Resources\/PlanCollection.php":1402537053,"app\/Http\/Resources\/InvoiceCollection.php":3442384146,"app\/Http\/Resources\/PageResource.php":2562874131,"app\/Http\/Resources\/UserResource.php":3514384770,"app\/Http\/Resources\/UserStorageResource.php":3173368149,"app\/Http\/Resources\/ShareResource.php":3638836792,"app\/Http\/Resources\/UserSubscription.php":1868974562,"app\/Http\/Resources\/InvoiceAdminResource.php":545842233,"app\/Http\/Resources\/InvoiceResource.php":4272309745,"app\/Http\/Resources\/PaymentCardCollection.php":35382430,"app\/Http\/Resources\/PlanResource.php":4254133748,"app\/Http\/Resources\/PaymentCardResource.php":407843952,"app\/Http\/Resources\/UsersCollection.php":3057145737,"app\/Http\/Requests\/Payments\/RegisterNewPaymentMethodRequest.php":2918618691,"app\/Http\/Requests\/Auth\/CheckAccountRequest.php":708120184,"app\/Http\/Requests\/Admin\/ChangeRoleRequest.php":1925938295,"app\/Http\/Requests\/Admin\/ChangeStorageCapacityRequest.php":1669862599,"app\/Http\/Requests\/Admin\/DeleteUserRequest.php":2636618911,"app\/Http\/Requests\/Admin\/CreateUserByAdmin.php":3365802358,"app\/Http\/Requests\/User\/UpdateUserPasswordRequest.php":2221986665,"app\/Http\/Requests\/Languages\/UpdateLanguageRequest.php":3062642093,"app\/Http\/Requests\/Languages\/UpdateStringRequest.php":477321427,"app\/Http\/Requests\/Languages\/CreateLanguageRequest.php":3242997343,"app\/Http\/Requests\/Subscription\/StoreUpgradeAccountRequest.php":3421291521,"app\/Http\/Requests\/FileBrowser\/SearchRequest.php":202095165,"app\/Http\/Requests\/PublicPages\/SendContactMessageRequest.php":3821039611,"app\/Http\/Requests\/SetupWizard\/StoreStripeCredentialsRequest.php":429869546,"app\/Http\/Requests\/SetupWizard\/StoreAppSetupRequest.php":2162069828,"app\/Http\/Requests\/SetupWizard\/StoreStripeBillingRequest.php":2767086903,"app\/Http\/Requests\/SetupWizard\/StoreEnvironmentSetupRequest.php":662138835,"app\/Http\/Requests\/SetupWizard\/StoreDatabaseCredentialsRequest.php":3405038241,"app\/Http\/Requests\/SetupWizard\/StoreStripePlansRequest.php":698544961,"app\/Http\/Requests\/FileFunctions\/DeleteItemRequest.php":3936258011,"app\/Http\/Requests\/FileFunctions\/CreateFolderRequest.php":1300625783,"app\/Http\/Requests\/FileFunctions\/UploadRequest.php":2854944424,"app\/Http\/Requests\/FileFunctions\/RenameItemRequest.php":3723095090,"app\/Http\/Requests\/FileFunctions\/MoveItemRequest.php":1125344009,"app\/Http\/Requests\/Share\/UpdateShareRequest.php":403673781,"app\/Http\/Requests\/Share\/CreateShareRequest.php":898178246,"app\/Http\/Requests\/Share\/AuthenticateShareRequest.php":1928811787,"app\/Http\/helpers.php":3539039584,"app\/Http\/Controllers\/Controller.php":923389314,"app\/Http\/Controllers\/Sharing\/ManipulateShareItemsController.php":14558414,"app\/Http\/Controllers\/Sharing\/FileSharedAccessController.php":3821037715,"app\/Http\/Controllers\/Sharing\/BrowseShareController.php":4259232858,"app\/Http\/Controllers\/App\/Maintenance.php":96974254,"app\/Http\/Controllers\/App\/SetupWizardController.php":1789728519,"app\/Http\/Controllers\/App\/AppFunctionsController.php":2947857832,"app\/Http\/Controllers\/Auth\/ForgotPasswordController.php":2521654140,"app\/Http\/Controllers\/Auth\/LoginController.php":2932123434,"app\/Http\/Controllers\/Auth\/ConfirmPasswordController.php":711266715,"app\/Http\/Controllers\/Auth\/AuthController.php":3570080690,"app\/Http\/Controllers\/Auth\/ResetPasswordController.php":348514476,"app\/Http\/Controllers\/Auth\/VerificationController.php":260994322,"app\/Http\/Controllers\/Admin\/UserController.php":4145576478,"app\/Http\/Controllers\/Admin\/DashboardController.php":3257386128,"app\/Http\/Controllers\/Admin\/SettingController.php":432117552,"app\/Http\/Controllers\/Admin\/InvoiceController.php":1079333231,"app\/Http\/Controllers\/Admin\/PlanController.php":3739538168,"app\/Http\/Controllers\/Admin\/LanguageController.php":158330191,"app\/Http\/Controllers\/Admin\/PagesController.php":3632846828,"app\/Http\/Controllers\/User\/AccountController.php":4219317847,"app\/Http\/Controllers\/User\/SubscriptionController.php":2751297300,"app\/Http\/Controllers\/User\/PaymentMethodsController.php":2933452549,"app\/Http\/Controllers\/Subscription\/StripeWebhookController.php":2426977191,"app\/Http\/Controllers\/FileManager\/FavouriteController.php":2757720034,"app\/Http\/Controllers\/FileManager\/TrashController.php":4243775923,"app\/Http\/Controllers\/FileManager\/EditItemsController.php":2432718425,"app\/Http\/Controllers\/FileManager\/BrowseController.php":115194502,"app\/Http\/Controllers\/FileManager\/ShareController.php":2848524553,"app\/Http\/Controllers\/FileManager\/FileAccessController.php":2326554064,"app\/Http\/Notifications\/ConfirmPayment.php":332683570,"app\/Http\/Kernel.php":2136109776,"app\/Actions\/Fortify\/UpdateUserProfileInformation.php":2472609909,"app\/Actions\/Fortify\/PasswordValidationRules.php":2923916238,"app\/Actions\/Fortify\/UpdateUserPassword.php":3951771953,"app\/Actions\/Fortify\/ResetUserPassword.php":4190615589,"app\/Actions\/Fortify\/CreateNewUser.php":3715974201,"app\/Rules\/DisabledMimetypes.php":3208905600,"app\/Notifications\/ResetPassword.php":3421477680,"app\/Notifications\/SharedSendViaEmail.php":113607832,"app\/Services\/DemoService.php":3417423904,"app\/Services\/LanguageService.php":2377025800,"app\/Services\/StripeService.php":988442640,"app\/Services\/SetupService.php":3211368368,"app\/Services\/SchedulerService.php":2085843092,"app\/Services\/FileManagerService.php":2226703157,"app\/Services\/HelperService.php":1615752066,"app\/Console\/Commands\/SetupProdEnvironment.php":1770210272,"app\/Console\/Commands\/SetupDevEnvironment.php":3776309589,"app\/Console\/Kernel.php":3670235513,"routes\/maintenance.php":3748923669,"routes\/file.php":3064209512,"routes\/user.php":4259547085,"routes\/channels.php":2877044881,"routes\/console.php":2045403946,"routes\/web.php":2818253027,"routes\/share.php":1915112226,"routes\/setup.php":174846292,"routes\/api.php":3451943582,"routes\/admin.php":1753159742,"config\/hashing.php":509629418,"config\/fortify.php":26876281,"config\/auth.php":3170093846,"config\/app.php":2412183403,"config\/laravel-query-monitor.php":1440668834,"config\/mail.php":328575859,"config\/language-translations.php":3255368688,"config\/services.php":2567151055,"config\/database.php":2792060856,"config\/cache.php":1332522112,"config\/cashier.php":3667756931,"config\/session.php":2232050276,"config\/content.php":395802805,"config\/backup.php":3248077103,"config\/queue.php":1206545377,"config\/custom-language-translations.php":1251541856,"config\/vuefilemanager.php":1126120216,"config\/broadcasting.php":2563027683,"config\/view.php":3441258419,"config\/scout.php":3982286810,"config\/cors.php":814133164,"config\/logging.php":794303111,"config\/filesystems.php":2319776559}} \ No newline at end of file +{"php":"7.4.12","version":"2.18.6:v2.18.6#5fed214993e7863cef88a08f214344891299b9e4","indent":" ","lineEnding":"\n","rules":{"blank_line_after_namespace":true,"braces":true,"class_definition":true,"constant_case":true,"elseif":true,"function_declaration":true,"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_spaces_after_function_name":true,"no_spaces_inside_parenthesis":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_import_per_statement":true,"single_line_after_imports":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"visibility_required":true,"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"ordered_imports":{"sortAlgorithm":"length"},"blank_line_before_statement":{"statements":["break","case","continue","declare","default","die","do","exit","for","foreach","goto","if","include","include_once","require","require_once","return","switch","throw","try","while","yield","yield_from"]},"class_attributes_separation":{"elements":["method"]},"no_extra_blank_lines":["break","case","continue","curly_brace_block","default","extra","parenthesis_brace_block","return","square_brace_block","switch","throw","use","useTrait","use_trait"],"cast_spaces":{"space":"single"},"phpdoc_single_line_var_spacing":true,"phpdoc_var_without_name":true,"single_space_after_construct":true,"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline_array":true,"phpdoc_scalar":true,"unary_operator_spaces":true,"binary_operator_spaces":true,"no_spaces_around_offset":true,"method_chaining_indentation":true,"array_indentation":true,"single_quote":true,"no_singleline_whitespace_before_semicolons":true,"no_empty_statement":true,"standardize_increment":true,"object_operator_without_whitespace":true,"ternary_operator_spaces":true,"no_leading_namespace_whitespace":true,"no_blank_lines_before_namespace":true,"fully_qualified_strict_types":true,"single_line_throw":true,"function_typehint_space":true,"simplified_if_return":true,"no_useless_else":true,"no_unneeded_curly_braces":true,"no_empty_comment":true,"no_blank_lines_after_class_opening":true,"whitespace_after_comma_in_array":true,"trim_array_spaces":true,"no_whitespace_before_comma_in_array":true,"lowercase_static_reference":true},"hashes":{"app\/Providers\/AppServiceProvider.php":2241922344,"app\/Providers\/FortifyServiceProvider.php":4138315837,"app\/Providers\/AuthServiceProvider.php":169859517,"app\/Providers\/RouteServiceProvider.php":1824013481,"app\/Providers\/BroadcastServiceProvider.php":3541093703,"app\/Providers\/EventServiceProvider.php":3395009334,"app\/Models\/LanguageTranslation.php":1555765712,"app\/Models\/Zip.php":2771946819,"app\/Models\/File.php":389252858,"app\/Models\/User.php":3940609624,"app\/Models\/Folder.php":3323761622,"app\/Models\/Invoice.php":3022282710,"app\/Models\/UserSettings.php":3400206961,"app\/Models\/Traffic.php":2512673789,"app\/Models\/Share.php":1870843212,"app\/Models\/Language.php":1756684391,"app\/Models\/Page.php":907354308,"app\/Models\/Setting.php":3917536845,"app\/Exceptions\/Handler.php":1302274777,"app\/Http\/Middleware\/VerifyCsrfToken.php":2876451146,"app\/Http\/Middleware\/RedirectIfAuthenticated.php":4037446582,"app\/Http\/Middleware\/TrimStrings.php":10633912,"app\/Http\/Middleware\/Authenticate.php":829439188,"app\/Http\/Middleware\/TrustProxies.php":3573151230,"app\/Http\/Middleware\/CheckForMaintenanceMode.php":3053801562,"app\/Http\/Middleware\/PreventRequestsDuringMaintenance.php":2280943271,"app\/Http\/Middleware\/EncryptCookies.php":1502216959,"app\/Http\/Mail\/SendContactMessage.php":594829001,"app\/Http\/Resources\/LanguageCollection.php":1364645788,"app\/Http\/Resources\/FileResource.php":2500497589,"app\/Http\/Resources\/PricingCollection.php":549452717,"app\/Http\/Resources\/PageCollection.php":842383211,"app\/Http\/Resources\/InvoiceAdminCollection.php":274747241,"app\/Http\/Resources\/PricingResource.php":2786525720,"app\/Http\/Resources\/PaymentDefaultCardResource.php":1710261108,"app\/Http\/Resources\/LanguageResource.php":1673048322,"app\/Http\/Resources\/PlanCollection.php":1402537053,"app\/Http\/Resources\/InvoiceCollection.php":3442384146,"app\/Http\/Resources\/PageResource.php":2562874131,"app\/Http\/Resources\/UserResource.php":3514384770,"app\/Http\/Resources\/UserStorageResource.php":3173368149,"app\/Http\/Resources\/ShareResource.php":3638836792,"app\/Http\/Resources\/UserSubscription.php":1868974562,"app\/Http\/Resources\/InvoiceAdminResource.php":545842233,"app\/Http\/Resources\/InvoiceResource.php":4272309745,"app\/Http\/Resources\/PaymentCardCollection.php":35382430,"app\/Http\/Resources\/PlanResource.php":4254133748,"app\/Http\/Resources\/PaymentCardResource.php":407843952,"app\/Http\/Resources\/UsersCollection.php":3057145737,"app\/Http\/Requests\/Payments\/RegisterNewPaymentMethodRequest.php":2918618691,"app\/Http\/Requests\/Auth\/CheckAccountRequest.php":708120184,"app\/Http\/Requests\/Admin\/ChangeRoleRequest.php":1925938295,"app\/Http\/Requests\/Admin\/ChangeStorageCapacityRequest.php":1669862599,"app\/Http\/Requests\/Admin\/DeleteUserRequest.php":2636618911,"app\/Http\/Requests\/Admin\/CreateUserByAdmin.php":3365802358,"app\/Http\/Requests\/User\/UpdateUserPasswordRequest.php":2221986665,"app\/Http\/Requests\/Languages\/UpdateLanguageRequest.php":3062642093,"app\/Http\/Requests\/Languages\/UpdateStringRequest.php":477321427,"app\/Http\/Requests\/Languages\/CreateLanguageRequest.php":3242997343,"app\/Http\/Requests\/Subscription\/StoreUpgradeAccountRequest.php":3421291521,"app\/Http\/Requests\/FileBrowser\/SearchRequest.php":202095165,"app\/Http\/Requests\/PublicPages\/SendContactMessageRequest.php":3821039611,"app\/Http\/Requests\/SetupWizard\/StoreStripeCredentialsRequest.php":429869546,"app\/Http\/Requests\/SetupWizard\/StoreAppSetupRequest.php":2162069828,"app\/Http\/Requests\/SetupWizard\/StoreStripeBillingRequest.php":2767086903,"app\/Http\/Requests\/SetupWizard\/StoreEnvironmentSetupRequest.php":662138835,"app\/Http\/Requests\/SetupWizard\/StoreDatabaseCredentialsRequest.php":3405038241,"app\/Http\/Requests\/SetupWizard\/StoreStripePlansRequest.php":698544961,"app\/Http\/Requests\/FileFunctions\/DeleteItemRequest.php":3936258011,"app\/Http\/Requests\/FileFunctions\/CreateFolderRequest.php":1300625783,"app\/Http\/Requests\/FileFunctions\/UploadRequest.php":2854944424,"app\/Http\/Requests\/FileFunctions\/RenameItemRequest.php":3723095090,"app\/Http\/Requests\/FileFunctions\/MoveItemRequest.php":1125344009,"app\/Http\/Requests\/Share\/UpdateShareRequest.php":403673781,"app\/Http\/Requests\/Share\/CreateShareRequest.php":898178246,"app\/Http\/Requests\/Share\/AuthenticateShareRequest.php":1928811787,"app\/Http\/helpers.php":3539039584,"app\/Http\/Controllers\/Controller.php":2646027293,"app\/Http\/Controllers\/Sharing\/ManipulateShareItemsController.php":14558414,"app\/Http\/Controllers\/Sharing\/FileSharedAccessController.php":3821037715,"app\/Http\/Controllers\/Sharing\/BrowseShareController.php":4259232858,"app\/Http\/Controllers\/App\/Maintenance.php":96974254,"app\/Http\/Controllers\/App\/SetupWizardController.php":1789728519,"app\/Http\/Controllers\/App\/AppFunctionsController.php":2947857832,"app\/Http\/Controllers\/Auth\/ForgotPasswordController.php":2521654140,"app\/Http\/Controllers\/Auth\/LoginController.php":2932123434,"app\/Http\/Controllers\/Auth\/ConfirmPasswordController.php":711266715,"app\/Http\/Controllers\/Auth\/AuthController.php":3570080690,"app\/Http\/Controllers\/Auth\/ResetPasswordController.php":348514476,"app\/Http\/Controllers\/Auth\/VerificationController.php":260994322,"app\/Http\/Controllers\/Admin\/UserController.php":4145576478,"app\/Http\/Controllers\/Admin\/DashboardController.php":3257386128,"app\/Http\/Controllers\/Admin\/SettingController.php":432117552,"app\/Http\/Controllers\/Admin\/InvoiceController.php":1079333231,"app\/Http\/Controllers\/Admin\/PlanController.php":3739538168,"app\/Http\/Controllers\/Admin\/LanguageController.php":158330191,"app\/Http\/Controllers\/Admin\/PagesController.php":3632846828,"app\/Http\/Controllers\/User\/AccountController.php":4219317847,"app\/Http\/Controllers\/User\/SubscriptionController.php":2751297300,"app\/Http\/Controllers\/User\/PaymentMethodsController.php":2933452549,"app\/Http\/Controllers\/Subscription\/StripeWebhookController.php":2426977191,"app\/Http\/Controllers\/FileManager\/FavouriteController.php":2757720034,"app\/Http\/Controllers\/FileManager\/TrashController.php":4243775923,"app\/Http\/Controllers\/FileManager\/EditItemsController.php":2432718425,"app\/Http\/Controllers\/FileManager\/BrowseController.php":115194502,"app\/Http\/Controllers\/FileManager\/ShareController.php":2848524553,"app\/Http\/Controllers\/FileManager\/FileAccessController.php":2326554064,"app\/Http\/Notifications\/ConfirmPayment.php":332683570,"app\/Http\/Kernel.php":2136109776,"app\/Actions\/Fortify\/UpdateUserProfileInformation.php":2472609909,"app\/Actions\/Fortify\/PasswordValidationRules.php":2923916238,"app\/Actions\/Fortify\/UpdateUserPassword.php":3951771953,"app\/Actions\/Fortify\/ResetUserPassword.php":4190615589,"app\/Actions\/Fortify\/CreateNewUser.php":3715974201,"app\/Rules\/DisabledMimetypes.php":3208905600,"app\/Notifications\/ResetPassword.php":3421477680,"app\/Notifications\/SharedSendViaEmail.php":113607832,"app\/Services\/DemoService.php":3417423904,"app\/Services\/LanguageService.php":2377025800,"app\/Services\/StripeService.php":988442640,"app\/Services\/SetupService.php":3211368368,"app\/Services\/SchedulerService.php":2085843092,"app\/Services\/FileManagerService.php":2226703157,"app\/Services\/HelperService.php":1615752066,"app\/Console\/Commands\/SetupProdEnvironment.php":1770210272,"app\/Console\/Commands\/SetupDevEnvironment.php":3776309589,"app\/Console\/Kernel.php":3670235513,"routes\/maintenance.php":3748923669,"routes\/file.php":3064209512,"routes\/user.php":4259547085,"routes\/channels.php":2877044881,"routes\/console.php":2045403946,"routes\/web.php":2818253027,"routes\/share.php":1915112226,"routes\/setup.php":174846292,"routes\/api.php":3451943582,"routes\/admin.php":1753159742,"config\/hashing.php":509629418,"config\/fortify.php":26876281,"config\/auth.php":3170093846,"config\/app.php":2412183403,"config\/laravel-query-monitor.php":1440668834,"config\/mail.php":328575859,"config\/language-translations.php":3255368688,"config\/services.php":2567151055,"config\/database.php":2792060856,"config\/cache.php":1332522112,"config\/cashier.php":3667756931,"config\/session.php":2232050276,"config\/content.php":395802805,"config\/backup.php":3248077103,"config\/queue.php":1206545377,"config\/custom-language-translations.php":1251541856,"config\/vuefilemanager.php":1126120216,"config\/broadcasting.php":2563027683,"config\/view.php":3441258419,"config\/scout.php":3982286810,"config\/cors.php":814133164,"config\/logging.php":794303111,"config\/filesystems.php":2319776559}} \ No newline at end of file diff --git a/app/Actions/Fortify/CreateNewUser.php b/app/Actions/Fortify/CreateNewUser.php index 76ff606e..b9cb8e2b 100644 --- a/app/Actions/Fortify/CreateNewUser.php +++ b/app/Actions/Fortify/CreateNewUser.php @@ -1,12 +1,11 @@ pluck('value', 'name'); // Check if account registration is enabled - if (!intval($settings['registration'])) { + if (! intval($settings['registration'])) { abort(401); } Validator::make($input, [ - 'name' => ['required', 'string', 'max:255'], - 'email' => [ + 'name' => ['required', 'string', 'max:255'], + 'email' => [ 'required', 'string', 'email', @@ -42,7 +41,7 @@ class CreateNewUser implements CreatesNewUsers ])->validate(); $user = User::create([ - 'email' => $input['email'], + 'email' => $input['email'], 'password' => bcrypt($input['password']), ]); @@ -51,7 +50,7 @@ class CreateNewUser implements CreatesNewUsers $user ->settings() ->create([ - 'name' => $input['name'], + 'name' => $input['name'], 'storage_capacity' => $settings['storage_default'], ]); diff --git a/app/Actions/Fortify/PasswordValidationRules.php b/app/Actions/Fortify/PasswordValidationRules.php index 78ed8cfe..9f6e39f1 100644 --- a/app/Actions/Fortify/PasswordValidationRules.php +++ b/app/Actions/Fortify/PasswordValidationRules.php @@ -1,5 +1,4 @@ 'admin', - 'email' => 'howdy@hi5ve.digital', + 'role' => 'admin', + 'email' => 'howdy@hi5ve.digital', 'password' => bcrypt('vuefilemanager'), ]); $user ->settings() ->create([ - 'avatar' => 'avatars/avatar-01.png', + 'avatar' => 'avatars/avatar-01.png', 'storage_capacity' => 5, - 'name' => 'Jane Doe', - 'address' => $this->faker->address, - 'state' => $this->faker->state, - 'city' => $this->faker->city, - 'postal_code' => $this->faker->postcode, - 'country' => $this->faker->randomElement(['SK', 'CZ', 'DE', 'FR']), - 'phone_number' => $this->faker->phoneNumber, - 'timezone' => $this->faker->randomElement(['+1.0', '+2.0', '+3.0']), + 'name' => 'Jane Doe', + 'address' => $this->faker->address, + 'state' => $this->faker->state, + 'city' => $this->faker->city, + 'postal_code' => $this->faker->postcode, + 'country' => $this->faker->randomElement(['SK', 'CZ', 'DE', 'FR']), + 'phone_number' => $this->faker->phoneNumber, + 'timezone' => $this->faker->randomElement(['+1.0', '+2.0', '+3.0']), ]); - Storage::putFileAs("avatars", storage_path("demo/avatars/avatar-01.png"), 'avatar-01.png', "private"); + Storage::putFileAs('avatars', storage_path('demo/avatars/avatar-01.png'), 'avatar-01.png', 'private'); // Show user credentials $this->info('Default admin account created. Email: howdy@hi5ve.digital and Password: vuefilemanager'); @@ -125,29 +123,28 @@ class SetupDevEnvironment extends Command 'avatar' => 'avatar-03.png', ], ])->each(function ($user) { - $newbie = User::forceCreate([ - 'role' => 'user', - 'email' => $this->faker->email, + 'role' => 'user', + 'email' => $this->faker->email, 'password' => bcrypt('vuefilemanager'), ]); $newbie ->settings() ->create([ - 'avatar' => "avatars/{$user['avatar']}", + 'avatar' => "avatars/{$user['avatar']}", 'storage_capacity' => 5, - 'name' => $this->faker->name, - 'address' => $this->faker->address, - 'state' => $this->faker->state, - 'city' => $this->faker->city, - 'postal_code' => $this->faker->postcode, - 'country' => $this->faker->randomElement(['SK', 'CZ', 'DE', 'FR']), - 'phone_number' => $this->faker->phoneNumber, - 'timezone' => $this->faker->randomElement(['+1.0', '+2.0', '+3.0']), + 'name' => $this->faker->name, + 'address' => $this->faker->address, + 'state' => $this->faker->state, + 'city' => $this->faker->city, + 'postal_code' => $this->faker->postcode, + 'country' => $this->faker->randomElement(['SK', 'CZ', 'DE', 'FR']), + 'phone_number' => $this->faker->phoneNumber, + 'timezone' => $this->faker->randomElement(['+1.0', '+2.0', '+3.0']), ]); - Storage::putFileAs("avatars", storage_path("demo/avatars/{$user['avatar']}"), $user['avatar'], "private"); + Storage::putFileAs('avatars', storage_path("demo/avatars/{$user['avatar']}"), $user['avatar'], 'private'); $this->info("Generated user with email: $newbie->email and Password: vuefilemanager"); }); @@ -164,51 +161,51 @@ class SetupDevEnvironment extends Command // 1. $shared_folder = Folder::factory(Folder::class) ->create([ - 'user_id' => $user->id, - 'author' => 'user', - 'name' => 'Shared Folder', - 'emoji' => [ - "codes" => "1F680", - "char" => "π", - "name" => "rocket", - "category" => "Travel & Places (transport-air)", - "group" => "Travel & Places", - "subgroup" => "transport-air" + 'user_id' => $user->id, + 'author' => 'user', + 'name' => 'Shared Folder', + 'emoji' => [ + 'codes' => '1F680', + 'char' => 'π', + 'name' => 'rocket', + 'category' => 'Travel & Places (transport-air)', + 'group' => 'Travel & Places', + 'subgroup' => 'transport-air', ], 'created_at' => now(), ]); Share::factory(Share::class) ->create([ - 'type' => 'folder', - 'item_id' => $shared_folder->id, - 'user_id' => $user->id, - 'permission' => 'editor', + 'type' => 'folder', + 'item_id' => $shared_folder->id, + 'user_id' => $user->id, + 'permission' => 'editor', 'is_protected' => false, - 'password' => null, - 'expire_in' => null, + 'password' => null, + 'expire_in' => null, ]); $peters_files = Folder::factory(Folder::class) ->create([ - 'user_id' => $user->id, + 'user_id' => $user->id, 'parent_id' => $shared_folder->id, - 'author' => 'visitor', - 'name' => "Peter's Files", + 'author' => 'visitor', + 'name' => "Peter's Files", ]); // 2. $random_pics = Folder::factory(Folder::class) ->create([ - 'user_id' => $user->id, - 'author' => 'user', - 'name' => 'Random Pics', - 'emoji' => [ - 'codes' => '1F4F7', - 'char' => 'π·', - 'name' => 'camera', + 'user_id' => $user->id, + 'author' => 'user', + 'name' => 'Random Pics', + 'emoji' => [ + 'codes' => '1F4F7', + 'char' => 'π·', + 'name' => 'camera', 'category' => 'Objects (light & video)', - 'group' => 'Objects', + 'group' => 'Objects', 'subgroup' => 'light & video', ], 'created_at' => now()->subMinutes(1), @@ -216,32 +213,32 @@ class SetupDevEnvironment extends Command $nature = Folder::factory(Folder::class) ->create([ - 'user_id' => $user->id, + 'user_id' => $user->id, 'parent_id' => $random_pics->id, - 'author' => 'user', - 'name' => "Nature", - 'emoji' => [ - 'codes' => '26F0', - 'char' => 'β°', - 'name' => 'mountain', + 'author' => 'user', + 'name' => 'Nature', + 'emoji' => [ + 'codes' => '26F0', + 'char' => 'β°', + 'name' => 'mountain', 'category' => 'Travel & Places (place-geographic)', - 'group' => 'Travel & Places', + 'group' => 'Travel & Places', 'subgroup' => 'place-geographic', ], ]); $apartments = Folder::factory(Folder::class) ->create([ - 'user_id' => $user->id, + 'user_id' => $user->id, 'parent_id' => $random_pics->id, - 'author' => 'user', - 'name' => "Apartments", - 'emoji' => [ - 'codes' => '1F3E0', - 'char' => 'π ', - 'name' => 'house', + 'author' => 'user', + 'name' => 'Apartments', + 'emoji' => [ + 'codes' => '1F3E0', + 'char' => 'π ', + 'name' => 'house', 'category' => 'Travel & Places (place-building)', - 'group' => 'Travel & Places', + 'group' => 'Travel & Places', 'subgroup' => 'place-building', ], ]); @@ -249,87 +246,87 @@ class SetupDevEnvironment extends Command // 3. $playable_media = Folder::factory(Folder::class) ->create([ - 'user_id' => $user->id, - 'author' => 'user', - 'name' => 'Playable Media', + 'user_id' => $user->id, + 'author' => 'user', + 'name' => 'Playable Media', 'created_at' => now()->subMinutes(2), ]); $video = Folder::factory(Folder::class) ->create([ - 'user_id' => $user->id, + 'user_id' => $user->id, 'parent_id' => $playable_media->id, - 'author' => 'user', - 'name' => "Video", + 'author' => 'user', + 'name' => 'Video', ]); $audio = Folder::factory(Folder::class) ->create([ - 'user_id' => $user->id, + 'user_id' => $user->id, 'parent_id' => $playable_media->id, - 'author' => 'user', - 'name' => "Audio", + 'author' => 'user', + 'name' => 'Audio', ]); // 4. $multi_level = Folder::factory(Folder::class) ->create([ - 'user_id' => $user->id, - 'author' => 'user', - 'name' => 'Multi Level Folder', + 'user_id' => $user->id, + 'author' => 'user', + 'name' => 'Multi Level Folder', 'created_at' => now()->subMinutes(3), ]); $first_level = Folder::factory(Folder::class) ->create([ - 'user_id' => $user->id, + 'user_id' => $user->id, 'parent_id' => $multi_level->id, - 'author' => 'user', - 'name' => "First Level", + 'author' => 'user', + 'name' => 'First Level', ]); $second_level = Folder::factory(Folder::class) ->create([ - 'user_id' => $user->id, + 'user_id' => $user->id, 'parent_id' => $first_level->id, - 'author' => 'user', - 'name' => "Second Level", + 'author' => 'user', + 'name' => 'Second Level', ]); $third_level = Folder::factory(Folder::class) ->create([ - 'user_id' => $user->id, + 'user_id' => $user->id, 'parent_id' => $second_level->id, - 'author' => 'user', - 'name' => "Third Level", + 'author' => 'user', + 'name' => 'Third Level', ]); // 5. $documents = Folder::factory(Folder::class) ->create([ - 'user_id' => $user->id, - 'author' => 'user', - 'name' => 'Documents', + 'user_id' => $user->id, + 'author' => 'user', + 'name' => 'Documents', 'created_at' => now()->subMinutes(4), ]); Share::factory(Share::class) ->create([ - 'type' => 'folder', - 'item_id' => $documents->id, - 'user_id' => $user->id, - 'permission' => 'editor', + 'type' => 'folder', + 'item_id' => $documents->id, + 'user_id' => $user->id, + 'permission' => 'editor', 'is_protected' => false, - 'password' => null, - 'expire_in' => null, + 'password' => null, + 'expire_in' => null, ]); // 6. $videohive = Folder::factory(Folder::class) ->create([ - 'user_id' => $user->id, - 'author' => 'user', - 'name' => 'Videohive by MakingCG', + 'user_id' => $user->id, + 'author' => 'user', + 'name' => 'Videohive by MakingCG', 'created_at' => now()->subMinutes(5), ]); @@ -345,43 +342,42 @@ class SetupDevEnvironment extends Command // Get documents to root directory collect([ [ - 'name' => 'Random Document', + 'name' => 'Random Document', 'basename' => 'Licence.pdf', 'mimetype' => 'pdf', ], [ - 'name' => 'School Report', + 'name' => 'School Report', 'basename' => 'Project Notes.pdf', 'mimetype' => 'pdf', ], [ - 'name' => 'Personal Savings', + 'name' => 'Personal Savings', 'basename' => 'School Report.pages', 'mimetype' => 'pages', ], [ - 'name' => 'Top Secret Files', + 'name' => 'Top Secret Files', 'basename' => 'Stories of the Night Skies.pages', 'mimetype' => 'pages', ], ]) ->each(function ($file) use ($user) { - $basename = Str::random(12) . '-' . $file['basename']; // Copy file into app storage - Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, "private"); + Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, 'private'); // Create file record File::create([ - 'folder_id' => null, - 'user_id' => $user->id, - 'name' => $file['name'], - 'basename' => $basename, - 'type' => 'file', - 'author' => 'user', - 'mimetype' => $file['mimetype'], - 'filesize' => rand(1000000, 4000000), + 'folder_id' => null, + 'user_id' => $user->id, + 'name' => $file['name'], + 'basename' => $basename, + 'type' => 'file', + 'author' => 'user', + 'mimetype' => $file['mimetype'], + 'filesize' => rand(1000000, 4000000), 'created_at' => now()->subMinutes(rand(1, 5)), ]); }); @@ -389,43 +385,42 @@ class SetupDevEnvironment extends Command // Get documents to documents folder collect([ [ - 'name' => 'Home Improvement', + 'name' => 'Home Improvement', 'basename' => 'Licence.pdf', 'mimetype' => 'pdf', ], [ - 'name' => 'Project Notes', + 'name' => 'Project Notes', 'basename' => 'Project Notes.pdf', 'mimetype' => 'pdf', ], [ - 'name' => 'Personal Savings', + 'name' => 'Personal Savings', 'basename' => 'School Report.pages', 'mimetype' => 'pages', ], [ - 'name' => 'License', + 'name' => 'License', 'basename' => 'Stories of the Night Skies.pages', 'mimetype' => 'pages', ], ]) ->each(function ($file) use ($user, $documents) { - $basename = Str::random(12) . '-' . $file['basename']; // Copy file into app storage - Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, "private"); + Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, 'private'); // Create file record File::create([ - 'folder_id' => $documents->id, - 'user_id' => $user->id, - 'name' => $file['name'], - 'basename' => $basename, - 'type' => 'file', - 'author' => 'user', - 'mimetype' => $file['mimetype'], - 'filesize' => rand(1000000, 4000000), + 'folder_id' => $documents->id, + 'user_id' => $user->id, + 'name' => $file['name'], + 'basename' => $basename, + 'type' => 'file', + 'author' => 'user', + 'mimetype' => $file['mimetype'], + 'filesize' => rand(1000000, 4000000), 'created_at' => now()->subMinutes(rand(1, 5)), ]); }); @@ -433,33 +428,32 @@ class SetupDevEnvironment extends Command // Get documents to shared folder collect([ [ - 'name' => 'Home plan', + 'name' => 'Home plan', 'basename' => 'Licence.pdf', 'mimetype' => 'pdf', ], [ - 'name' => 'Software Licence', + 'name' => 'Software Licence', 'basename' => 'Project Notes.pdf', 'mimetype' => 'pdf', - ] + ], ]) ->each(function ($file) use ($user, $shared_folder) { - $basename = Str::random(12) . '-' . $file['basename']; // Copy file into app storage - Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, "private"); + Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, 'private'); // Create file record File::create([ - 'folder_id' => $shared_folder->id, - 'user_id' => $user->id, - 'name' => $file['name'], - 'basename' => $basename, - 'type' => 'file', - 'author' => 'user', - 'mimetype' => $file['mimetype'], - 'filesize' => rand(1000000, 4000000), + 'folder_id' => $shared_folder->id, + 'user_id' => $user->id, + 'name' => $file['name'], + 'basename' => $basename, + 'type' => 'file', + 'author' => 'user', + 'mimetype' => $file['mimetype'], + 'filesize' => rand(1000000, 4000000), 'created_at' => now()->subMinutes(rand(1, 5)), ]); }); @@ -467,58 +461,57 @@ class SetupDevEnvironment extends Command // Get documents to peter's files folder collect([ [ - 'name' => 'Project Backup', + 'name' => 'Project Backup', 'basename' => 'Licence.pdf', 'mimetype' => 'pdf', ], [ - 'name' => 'Yearly report', + 'name' => 'Yearly report', 'basename' => 'Project Notes.pdf', 'mimetype' => 'pdf', ], [ - 'name' => 'Work Update', + 'name' => 'Work Update', 'basename' => 'School Report.pages', 'mimetype' => 'pages', ], [ - 'name' => 'Person Writing on Notebook', + 'name' => 'Person Writing on Notebook', 'basename' => 'Stories of the Night Skies.pages', 'mimetype' => 'pages', ], [ - 'name' => 'Blank Business Composition Computer', + 'name' => 'Blank Business Composition Computer', 'basename' => 'Licence.pdf', 'mimetype' => 'pdf', ], [ - 'name' => '2020 April - Export', + 'name' => '2020 April - Export', 'basename' => 'Project Notes.pdf', 'mimetype' => 'pdf', ], [ - 'name' => 'Ballpen Blur Close Up Computer', + 'name' => 'Ballpen Blur Close Up Computer', 'basename' => 'School Report.pages', 'mimetype' => 'pages', ], ]) ->each(function ($file) use ($user, $peters_files) { - $basename = Str::random(12) . '-' . $file['basename']; // Copy file into app storage - Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, "private"); + Storage::putFileAs("files/$user->id", storage_path("demo/documents/{$file['basename']}"), $basename, 'private'); // Create file record File::create([ - 'folder_id' => $peters_files->id, - 'user_id' => $user->id, - 'name' => $file['name'], - 'basename' => $basename, - 'type' => 'file', - 'author' => 'visitor', - 'mimetype' => $file['mimetype'], - 'filesize' => rand(1000000, 4000000), + 'folder_id' => $peters_files->id, + 'user_id' => $user->id, + 'name' => $file['name'], + 'basename' => $basename, + 'type' => 'file', + 'author' => 'visitor', + 'mimetype' => $file['mimetype'], + 'filesize' => rand(1000000, 4000000), 'created_at' => now()->subMinutes(rand(1, 5)), ]); }); @@ -531,22 +524,21 @@ class SetupDevEnvironment extends Command 'Sphere Bound 3D Titles.mp4', ]) ->each(function ($file) use ($user, $videohive) { - $basename = Str::random(12) . '-' . $file; // Copy file into app storage - Storage::putFileAs("files/$user->id", storage_path("demo/video/$file"), $basename, "private"); + Storage::putFileAs("files/$user->id", storage_path("demo/video/$file"), $basename, 'private'); // Create file record File::create([ - 'folder_id' => $videohive->id, - 'user_id' => $user->id, - 'name' => $file, - 'basename' => $basename, - 'type' => 'video', - 'author' => 'user', - 'mimetype' => 'mp4', - 'filesize' => rand(1000000, 4000000), + 'folder_id' => $videohive->id, + 'user_id' => $user->id, + 'name' => $file, + 'basename' => $basename, + 'type' => 'video', + 'author' => 'user', + 'mimetype' => 'mp4', + 'filesize' => rand(1000000, 4000000), 'created_at' => now()->subMinutes(rand(1, 5)), ]); }); @@ -556,22 +548,21 @@ class SetupDevEnvironment extends Command 'Apple Watch App Video Promotion.mp4', ]) ->each(function ($file) use ($user, $video) { - $basename = Str::random(12) . '-' . $file; // Copy file into app storage - Storage::putFileAs("files/$user->id", storage_path("demo/video/$file"), $basename, "private"); + Storage::putFileAs("files/$user->id", storage_path("demo/video/$file"), $basename, 'private'); // Create file record File::create([ - 'folder_id' => $video->id, - 'user_id' => $user->id, - 'name' => $file, - 'basename' => $basename, - 'type' => 'video', - 'author' => 'user', - 'mimetype' => 'mp4', - 'filesize' => rand(1000000, 4000000), + 'folder_id' => $video->id, + 'user_id' => $user->id, + 'name' => $file, + 'basename' => $basename, + 'type' => 'video', + 'author' => 'user', + 'mimetype' => 'mp4', + 'filesize' => rand(1000000, 4000000), 'created_at' => now()->subMinutes(rand(1, 5)), ]); }); @@ -581,22 +572,21 @@ class SetupDevEnvironment extends Command 'D-Block & S-te-Fan - Bla Bla.mp3', ]) ->each(function ($file) use ($user, $audio) { - $basename = Str::random(12) . '-' . $file; // Copy file into app storage - Storage::putFileAs("files/$user->id", storage_path("demo/audio/$file"), $basename, "private"); + Storage::putFileAs("files/$user->id", storage_path("demo/audio/$file"), $basename, 'private'); // Create file record File::create([ - 'folder_id' => $audio->id, - 'user_id' => $user->id, - 'name' => $file, - 'basename' => $basename, - 'type' => 'audio', - 'author' => 'user', - 'mimetype' => 'mp3', - 'filesize' => rand(1000000, 4000000), + 'folder_id' => $audio->id, + 'user_id' => $user->id, + 'name' => $file, + 'basename' => $basename, + 'type' => 'audio', + 'author' => 'user', + 'mimetype' => 'mp3', + 'filesize' => rand(1000000, 4000000), 'created_at' => now()->subMinutes(rand(1, 5)), ]); }); @@ -617,24 +607,23 @@ class SetupDevEnvironment extends Command 'You Are My Sunshine.jpg', ]) ->each(function ($file) use ($user, $apartments) { - $basename = Str::random(12) . '-' . $file; // Copy file into app storage - Storage::putFileAs("files/$user->id", storage_path("demo/images/memes/$file"), $basename, "private"); - Storage::putFileAs("files/$user->id", storage_path("demo/images/memes/thumbnail-$file"), "thumbnail-$basename", "private"); + Storage::putFileAs("files/$user->id", storage_path("demo/images/memes/$file"), $basename, 'private'); + Storage::putFileAs("files/$user->id", storage_path("demo/images/memes/thumbnail-$file"), "thumbnail-$basename", 'private'); // Create file record File::create([ - 'folder_id' => null, - 'user_id' => $user->id, - 'name' => $file, - 'basename' => $basename, - 'type' => 'image', - 'author' => 'user', - 'mimetype' => 'jpg', - 'filesize' => rand(1000000, 4000000), - 'thumbnail' => "thumbnail-$basename", + 'folder_id' => null, + 'user_id' => $user->id, + 'name' => $file, + 'basename' => $basename, + 'type' => 'image', + 'author' => 'user', + 'mimetype' => 'jpg', + 'filesize' => rand(1000000, 4000000), + 'thumbnail' => "thumbnail-$basename", 'created_at' => now()->subMinutes(rand(1, 5)), ]); }); @@ -650,24 +639,23 @@ class SetupDevEnvironment extends Command 'Kitchen Island.jpg', ]) ->each(function ($file) use ($user, $apartments) { - $basename = Str::random(12) . '-' . $file; // Copy file into app storage - Storage::putFileAs("files/$user->id", storage_path("demo/images/apartments/$file"), $basename, "private"); - Storage::putFileAs("files/$user->id", storage_path("demo/images/apartments/thumbnail-$file"), "thumbnail-$basename", "private"); + Storage::putFileAs("files/$user->id", storage_path("demo/images/apartments/$file"), $basename, 'private'); + Storage::putFileAs("files/$user->id", storage_path("demo/images/apartments/thumbnail-$file"), "thumbnail-$basename", 'private'); // Create file record File::create([ - 'folder_id' => $apartments->id, - 'user_id' => $user->id, - 'name' => $file, - 'basename' => $basename, - 'type' => 'image', - 'author' => 'user', - 'mimetype' => 'jpg', - 'filesize' => rand(1000000, 4000000), - 'thumbnail' => "thumbnail-$basename", + 'folder_id' => $apartments->id, + 'user_id' => $user->id, + 'name' => $file, + 'basename' => $basename, + 'type' => 'image', + 'author' => 'user', + 'mimetype' => 'jpg', + 'filesize' => rand(1000000, 4000000), + 'thumbnail' => "thumbnail-$basename", 'created_at' => now()->subMinutes(rand(1, 5)), ]); }); @@ -687,24 +675,23 @@ class SetupDevEnvironment extends Command 'Yellow Animal Eyes Fur.jpg', ]) ->each(function ($file) use ($user, $nature) { - $basename = Str::random(12) . '-' . $file; // Copy file into app storage - Storage::putFileAs("files/$user->id", storage_path("demo/images/nature/$file"), $basename, "private"); - Storage::putFileAs("files/$user->id", storage_path("demo/images/nature/thumbnail-$file"), "thumbnail-$basename", "private"); + Storage::putFileAs("files/$user->id", storage_path("demo/images/nature/$file"), $basename, 'private'); + Storage::putFileAs("files/$user->id", storage_path("demo/images/nature/thumbnail-$file"), "thumbnail-$basename", 'private'); // Create file record File::create([ - 'folder_id' => $nature->id, - 'user_id' => $user->id, - 'name' => $file, - 'basename' => $basename, - 'type' => 'image', - 'author' => 'user', - 'mimetype' => 'jpg', - 'filesize' => rand(1000000, 4000000), - 'thumbnail' => "thumbnail-$basename", + 'folder_id' => $nature->id, + 'user_id' => $user->id, + 'name' => $file, + 'basename' => $basename, + 'type' => 'image', + 'author' => 'user', + 'mimetype' => 'jpg', + 'filesize' => rand(1000000, 4000000), + 'thumbnail' => "thumbnail-$basename", 'created_at' => now()->subMinutes(rand(1, 5)), ]); }); @@ -722,13 +709,13 @@ class SetupDevEnvironment extends Command $images->each(function ($id) use ($user) { Share::create([ - 'user_id' => $user->id, - 'item_id' => $id, - 'type' => 'file', + 'user_id' => $user->id, + 'item_id' => $id, + 'type' => 'file', 'is_protected' => false, - 'permission' => 'editor', - 'password' => null, - 'expire_in' => null, + 'permission' => 'editor', + 'password' => null, + 'expire_in' => null, ]); }); @@ -739,13 +726,13 @@ class SetupDevEnvironment extends Command $files->each(function ($id) use ($user) { Share::create([ - 'user_id' => $user->id, - 'item_id' => $id, - 'type' => 'file', + 'user_id' => $user->id, + 'item_id' => $id, + 'type' => 'file', 'is_protected' => false, - 'permission' => 'editor', - 'password' => null, - 'expire_in' => null, + 'permission' => 'editor', + 'password' => null, + 'expire_in' => null, ]); }); } @@ -758,116 +745,116 @@ class SetupDevEnvironment extends Command // Get options collect([ [ - 'name' => 'setup_wizard_database', + 'name' => 'setup_wizard_database', 'value' => 1, ], [ - 'name' => 'app_title', + 'name' => 'app_title', 'value' => 'VueFileManager', ], [ - 'name' => 'app_description', + 'name' => 'app_description', 'value' => 'Your self-hosted storage cloud software powered by Laravel and Vue', ], [ - 'name' => 'app_logo', + 'name' => 'app_logo', 'value' => 'system/logo.svg', ], [ - 'name' => 'app_logo_horizontal', + 'name' => 'app_logo_horizontal', 'value' => 'system/logo-horizontal.svg', ], [ - 'name' => 'app_favicon', + 'name' => 'app_favicon', 'value' => 'system/favicon.png', ], [ - 'name' => 'app_og_image', + 'name' => 'app_og_image', 'value' => 'system/og-image.jpg', ], [ - 'name' => 'app_touch_icon', + 'name' => 'app_touch_icon', 'value' => 'system/touch-icon.png', ], [ - 'name' => 'google_analytics', + 'name' => 'google_analytics', 'value' => '', ], [ - 'name' => 'contact_email', + 'name' => 'contact_email', 'value' => '', ], [ - 'name' => 'registration', + 'name' => 'registration', 'value' => 1, ], [ - 'name' => 'payments_active', + 'name' => 'payments_active', 'value' => 1, ], [ - 'name' => 'storage_limitation', + 'name' => 'storage_limitation', 'value' => 1, ], [ - 'name' => 'storage_default', + 'name' => 'storage_default', 'value' => 5, ], [ - 'name' => 'setup_wizard_success', + 'name' => 'setup_wizard_success', 'value' => 1, ], [ - 'name' => 'license', + 'name' => 'license', 'value' => $this->license, ], [ - 'name' => 'purchase_code', + 'name' => 'purchase_code', 'value' => '26b889eb-3602-4bf2-beb3-3sc378fcf484', ], [ - 'name' => 'billing_address', + 'name' => 'billing_address', 'value' => 'Palo Alto 20', ], [ - 'name' => 'billing_city', + 'name' => 'billing_city', 'value' => 'Palo Alto', ], [ - 'name' => 'billing_country', + 'name' => 'billing_country', 'value' => 'US', ], [ - 'name' => 'billing_name', + 'name' => 'billing_name', 'value' => 'VueFileManager Inc.', ], [ - 'name' => 'billing_phone_number', + 'name' => 'billing_phone_number', 'value' => '312343141243214', ], [ - 'name' => 'billing_postal_code', + 'name' => 'billing_postal_code', 'value' => '43213', ], [ - 'name' => 'billing_state', + 'name' => 'billing_state', 'value' => 'California', ], [ - 'name' => 'billing_vat_number', + 'name' => 'billing_vat_number', 'value' => '41241241234', - ] + ], ])->each(function ($col) { Setting::forceCreate([ - 'name' => $col['name'], - 'value' => $col['value'] + 'name' => $col['name'], + 'value' => $col['value'], ]); }); // Get system images collect(['logo.svg', 'logo-horizontal.svg', 'favicon.png', 'og-image.jpg', 'touch-icon.png']) ->each(function ($file) { - Storage::putFileAs("system", storage_path("demo/app/$file"), $file, "private"); + Storage::putFileAs('system', storage_path("demo/app/$file"), $file, 'private'); }); } @@ -878,12 +865,12 @@ class SetupDevEnvironment extends Command { // Migrate database $this->call('migrate:fresh', [ - '--force' => true + '--force' => true, ]); // Generate app key $this->call('key:generate', [ - '--force' => true + '--force' => true, ]); } @@ -896,4 +883,4 @@ class SetupDevEnvironment extends Command $this->call('config:clear'); $this->call('view:clear'); } -} \ No newline at end of file +} diff --git a/app/Console/Commands/SetupProdEnvironment.php b/app/Console/Commands/SetupProdEnvironment.php index a0b2195e..362723a2 100644 --- a/app/Console/Commands/SetupProdEnvironment.php +++ b/app/Console/Commands/SetupProdEnvironment.php @@ -1,9 +1,8 @@ 'setup_wizard_database', + 'name' => 'setup_wizard_database', 'value' => 1, ], [ - 'name' => 'app_title', + 'name' => 'app_title', 'value' => 'VueFileManager', ], [ - 'name' => 'app_description', + 'name' => 'app_description', 'value' => 'Your self-hosted storage cloud software powered by Laravel and Vue', ], [ - 'name' => 'app_logo', + 'name' => 'app_logo', 'value' => null, ], [ - 'name' => 'app_logo_horizontal', + 'name' => 'app_logo_horizontal', 'value' => null, ], [ - 'name' => 'app_favicon', + 'name' => 'app_favicon', 'value' => null, ], [ - 'name' => 'app_og_image', + 'name' => 'app_og_image', 'value' => null, ], [ - 'name' => 'app_touch_icon', + 'name' => 'app_touch_icon', 'value' => null, ], [ - 'name' => 'google_analytics', + 'name' => 'google_analytics', 'value' => null, ], [ - 'name' => 'contact_email', + 'name' => 'contact_email', 'value' => null, ], [ - 'name' => 'registration', + 'name' => 'registration', 'value' => 0, ], [ - 'name' => 'storage_limitation', + 'name' => 'storage_limitation', 'value' => 1, ], [ - 'name' => 'storage_default', + 'name' => 'storage_default', 'value' => 5, ], [ - 'name' => 'setup_wizard_success', + 'name' => 'setup_wizard_success', 'value' => 1, ], [ - 'name' => 'license', + 'name' => 'license', 'value' => $this->license, ], [ - 'name' => 'purchase_code', + 'name' => 'purchase_code', 'value' => '26b889eb-3602-4bf2-beb3-3sc378fcf484', ], [ - 'name' => 'billing_address', + 'name' => 'billing_address', 'value' => null, ], [ - 'name' => 'billing_city', + 'name' => 'billing_city', 'value' => null, ], [ - 'name' => 'billing_country', + 'name' => 'billing_country', 'value' => null, ], [ - 'name' => 'billing_name', + 'name' => 'billing_name', 'value' => null, ], [ - 'name' => 'billing_phone_number', + 'name' => 'billing_phone_number', 'value' => null, ], [ - 'name' => 'billing_postal_code', + 'name' => 'billing_postal_code', 'value' => null, ], [ - 'name' => 'billing_state', + 'name' => 'billing_state', 'value' => null, ], [ - 'name' => 'billing_vat_number', + 'name' => 'billing_vat_number', 'value' => null, - ] + ], ])->each(function ($col) { Setting::forceCreate([ - 'name' => $col['name'], - 'value' => $col['value'] + 'name' => $col['name'], + 'value' => $col['value'], ]); }); } @@ -180,8 +178,8 @@ class SetupProdEnvironment extends Command private function create_admin(): void { $user = User::forceCreate([ - 'role' => 'admin', - 'email' => 'admin@vuefilemanager.com', + 'role' => 'admin', + 'email' => 'admin@vuefilemanager.com', 'password' => bcrypt('vuefilemanager'), ]); @@ -189,7 +187,7 @@ class SetupProdEnvironment extends Command ->settings() ->create([ 'storage_capacity' => 5, - 'name' => 'Admin', + 'name' => 'Admin', ]); // Show user credentials @@ -203,12 +201,12 @@ class SetupProdEnvironment extends Command { // Migrate database $this->call('migrate:fresh', [ - '--force' => true + '--force' => true, ]); // Generate app key $this->call('key:generate', [ - '--force' => true + '--force' => true, ]); } diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index aa353d19..0103e35d 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -1,11 +1,10 @@ call(function () use ($scheduler) { $scheduler->delete_old_zips(); - if (!is_storage_driver(['local'])) { + if (! is_storage_driver(['local'])) { $scheduler->delete_failed_files(); } })->everySixHours(); diff --git a/app/Exceptions/Handler.php b/app/Exceptions/Handler.php index a0aff064..eecf61b7 100644 --- a/app/Exceptions/Handler.php +++ b/app/Exceptions/Handler.php @@ -1,10 +1,9 @@ redirectTo('/not-found')->setStatusCode(404); } return parent::render($request, $exception); } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/Admin/DashboardController.php b/app/Http/Controllers/Admin/DashboardController.php index d35bcfc4..1031eb19 100644 --- a/app/Http/Controllers/Admin/DashboardController.php +++ b/app/Http/Controllers/Admin/DashboardController.php @@ -1,15 +1,13 @@ format(); return [ - 'license' => get_setting('license'), - 'app_version' => config('vuefilemanager.version'), - 'total_users' => User::count(), - 'total_used_space' => $storage_usage, + 'license' => get_setting('license'), + 'app_version' => config('vuefilemanager.version'), + 'total_users' => User::count(), + 'total_used_space' => $storage_usage, 'total_premium_users' => $premium_users, ]; } diff --git a/app/Http/Controllers/Admin/InvoiceController.php b/app/Http/Controllers/Admin/InvoiceController.php index 8ea293e0..d2e6aae3 100644 --- a/app/Http/Controllers/Admin/InvoiceController.php +++ b/app/Http/Controllers/Admin/InvoiceController.php @@ -1,14 +1,11 @@ get()), 200 + new LanguageCollection(Language::sortable(['created_at', 'DESC'])->get()), + 200 ); } @@ -36,7 +36,8 @@ class LanguageController extends Controller public function get_language(Language $language) { return response( - new LanguageResource($language), 200 + new LanguageResource($language), + 200 ); } @@ -52,12 +53,13 @@ class LanguageController extends Controller abort_if(is_demo(), 204, 'Done.'); $language = Language::create([ - 'name' => $request->input('name'), - 'locale' => $request->input('locale') + 'name' => $request->input('name'), + 'locale' => $request->input('locale'), ]); return response( - new LanguageResource($language), 201 + new LanguageResource($language), + 201 ); } @@ -75,7 +77,8 @@ class LanguageController extends Controller $language->update(make_single_input($request)); return response( - new LanguageResource($language), 201 + new LanguageResource($language), + 201 ); } @@ -95,13 +98,14 @@ class LanguageController extends Controller ->languageTranslations() ->where('key', $request->name) ->update([ - 'value' => $request->value + 'value' => $request->value, ]); cache()->forget("language-translations-{$language->locale}"); return response( - 'Done', 204 + 'Done', + 204 ); } @@ -130,7 +134,8 @@ class LanguageController extends Controller $language->delete(); return response( - 'Done', 204 + 'Done', + 204 ); } } diff --git a/app/Http/Controllers/Admin/PagesController.php b/app/Http/Controllers/Admin/PagesController.php index 5a93fbfe..632d8195 100644 --- a/app/Http/Controllers/Admin/PagesController.php +++ b/app/Http/Controllers/Admin/PagesController.php @@ -1,15 +1,14 @@ column, '|') !== false) { - $columns = explode('|', $request->column); return Setting::whereIn('name', $columns) @@ -54,12 +52,11 @@ class SettingController extends Controller // Store image if exist if ($request->hasFile($request->name)) { - // Find and update image path Setting::updateOrCreate([ - 'name' => $request->name + 'name' => $request->name, ], [ - 'value' => store_system_image($request, $request->name) + 'value' => store_system_image($request, $request->name), ]); return response('Done', 204); @@ -86,14 +83,13 @@ class SettingController extends Controller // Abort in demo mode abort_if(is_demo(), 204, 'Done.'); - if (!app()->runningUnitTests()) { - + if (! app()->runningUnitTests()) { setEnvironmentValue([ - 'MAIL_DRIVER' => $request->driver, - 'MAIL_HOST' => $request->host, - 'MAIL_PORT' => $request->port, - 'MAIL_USERNAME' => $request->username, - 'MAIL_PASSWORD' => $request->password, + 'MAIL_DRIVER' => $request->driver, + 'MAIL_HOST' => $request->host, + 'MAIL_PORT' => $request->port, + 'MAIL_USERNAME' => $request->username, + 'MAIL_PASSWORD' => $request->password, 'MAIL_ENCRYPTION' => $request->encryption, ]); @@ -120,45 +116,42 @@ class SettingController extends Controller // Try to get stripe account details try { - if (!app()->runningUnitTests()) { - + if (! app()->runningUnitTests()) { Stripe::make($request->secret, '2020-03-02') ->account() ->details(); } } catch (UnauthorizedException $e) { - throw new HttpException(401, $e->getMessage()); } // Get options collect([ [ - 'name' => 'stripe_currency', + 'name' => 'stripe_currency', 'value' => $request->currency, ], [ - 'name' => 'payments_configured', + 'name' => 'payments_configured', 'value' => 1, ], [ - 'name' => 'payments_active', + 'name' => 'payments_active', 'value' => 1, ], ])->each(function ($col) { Setting::forceCreate([ - 'name' => $col['name'], + 'name' => $col['name'], 'value' => $col['value'], ]); }); - if (!app()->runningUnitTests()) { - + if (! app()->runningUnitTests()) { // Set stripe credentials to .env setEnvironmentValue([ - 'CASHIER_CURRENCY' => $request->currency, - 'STRIPE_KEY' => $request->key, - 'STRIPE_SECRET' => $request->secret, + 'CASHIER_CURRENCY' => $request->currency, + 'STRIPE_KEY' => $request->key, + 'STRIPE_SECRET' => $request->secret, 'STRIPE_WEBHOOK_SECRET' => $request->webhookSecret, ]); @@ -179,7 +172,7 @@ class SettingController extends Controller // Abort in demo mode abort_if(is_demo(), 204, 'Done.'); - if (!app()->runningUnitTests()) { + if (! app()->runningUnitTests()) { Artisan::call('cache:clear'); Artisan::call('config:clear'); Artisan::call('config:cache'); diff --git a/app/Http/Controllers/Admin/UserController.php b/app/Http/Controllers/Admin/UserController.php index 1925fdfb..3a036e45 100644 --- a/app/Http/Controllers/Admin/UserController.php +++ b/app/Http/Controllers/Admin/UserController.php @@ -1,29 +1,25 @@ stripeId() || !$user->subscription('main')) { + if (! $user->stripeId() || ! $user->subscription('main')) { return response("User doesn't have any subscription.", 404); } @@ -179,8 +175,8 @@ class UserController extends Controller { // Create user $user = User::forceCreate([ - 'role' => $request->role, - 'email' => $request->email, + 'role' => $request->role, + 'email' => $request->email, 'password' => bcrypt($request->password), ]); @@ -189,8 +185,8 @@ class UserController extends Controller $user ->settings() ->create([ - 'name' => $request->name, - 'avatar' => store_avatar($request, 'avatar'), + 'name' => $request->name, + 'avatar' => store_avatar($request, 'avatar'), 'storage_capacity' => $request->storage_capacity, ]); @@ -222,7 +218,7 @@ class UserController extends Controller } if ($user->settings->name !== $request->name) { - abort(403, "The name you typed is wrong!"); + abort(403, 'The name you typed is wrong!'); } $user->delete(); diff --git a/app/Http/Controllers/App/AppFunctionsController.php b/app/Http/Controllers/App/AppFunctionsController.php index 2087d1c2..0e917ab6 100644 --- a/app/Http/Controllers/App/AppFunctionsController.php +++ b/app/Http/Controllers/App/AppFunctionsController.php @@ -1,23 +1,22 @@ with('settings', $settings ?? null) ->with('legal', $pages ?? null) ->with('installation', $setup_status); @@ -78,24 +75,24 @@ class AppFunctionsController extends Controller // Get file/folder record $item = ('App\\Models\\' . ucfirst($shared->type)) ::where('user_id', $shared->user->id) - ->where('id', $shared->item_id) - ->first(); + ->where('id', $shared->item_id) + ->first(); if ($item->thumbnail) { $item->setPublicUrl($shared->token); } - return view("vuefilemanager.crawler.og-view") + return view('vuefilemanager.crawler.og-view') ->with('settings', get_settings_in_json()) ->with('metadata', [ - 'url' => url('/share', ['token' => $shared->token]), + 'url' => url('/share', ['token' => $shared->token]), 'is_protected' => $shared->is_protected, - 'user' => $shared->user->settings->name, - 'name' => $item->name, - 'size' => $shared->type === 'folder' + 'user' => $shared->user->settings->name, + 'name' => $item->name, + 'size' => $shared->type === 'folder' ? $item->items : $item->filesize, - 'thumbnail' => $item->thumbnail ?? null, + 'thumbnail' => $item->thumbnail ?? null, ]); } @@ -136,7 +133,6 @@ class AppFunctionsController extends Controller public function get_setting_columns(Request $request) { if (strpos($request->column, '|') !== false) { - $columns = collect(explode('|', $request->column)) ->each(function ($column) { if (in_array($column, $this->blacklist)) { diff --git a/app/Http/Controllers/App/Maintenance.php b/app/Http/Controllers/App/Maintenance.php index 6bc28675..675ecb97 100644 --- a/app/Http/Controllers/App/Maintenance.php +++ b/app/Http/Controllers/App/Maintenance.php @@ -1,19 +1,14 @@ upgrade_language_translations(); - - return response('Done.', 201); } @@ -75,7 +68,7 @@ class Maintenance extends Controller Gate::authorize('maintenance'); $command = Artisan::call('migrate', [ - '--force' => true + '--force' => true, ]); if ($command === 0) { @@ -85,6 +78,7 @@ class Maintenance extends Controller if ($command === 1) { echo 'Operation failed.'; } + return $command; } } diff --git a/app/Http/Controllers/App/SetupWizardController.php b/app/Http/Controllers/App/SetupWizardController.php index 8c5f1d61..18f8381d 100644 --- a/app/Http/Controllers/App/SetupWizardController.php +++ b/app/Http/Controllers/App/SetupWizardController.php @@ -1,31 +1,29 @@ runningUnitTests()) { - + if (! app()->runningUnitTests()) { try { // Set temporary database connection config(['database.connections.test.driver' => $request->connection]); @@ -79,7 +76,6 @@ class SetupWizardController extends Controller // Test connection \DB::connection('test')->getPdo(); - } catch (PDOException $e) { throw new HttpException(500, $e->getMessage()); } @@ -88,27 +84,27 @@ class SetupWizardController extends Controller setEnvironmentValue([ 'DB_CONNECTION' => $request->connection, - 'DB_HOST' => $request->host, - 'DB_PORT' => $request->port, - 'DB_DATABASE' => $request->name, - 'DB_USERNAME' => $request->username, - 'DB_PASSWORD' => $request->password, + 'DB_HOST' => $request->host, + 'DB_PORT' => $request->port, + 'DB_DATABASE' => $request->name, + 'DB_USERNAME' => $request->username, + 'DB_PASSWORD' => $request->password, ]); Artisan::call('config:cache'); Artisan::call('key:generate', [ - '--force' => true + '--force' => true, ]); Artisan::call('migrate:fresh', [ - '--force' => true + '--force' => true, ]); } // Store setup wizard progress Setting::forceCreate([ - 'name' => 'setup_wizard_database', + 'name' => 'setup_wizard_database', 'value' => 1, ]); @@ -123,15 +119,13 @@ class SetupWizardController extends Controller */ public function store_stripe_credentials(StoreStripeCredentialsRequest $request) { - if (!app()->runningUnitTests()) { - + if (! app()->runningUnitTests()) { // Create stripe instance $stripe = Stripe::make($request->secret, '2020-03-02'); try { // Try to get stripe account details $stripe->account()->details(); - } catch (UnauthorizedException $e) { throw new HttpException(401, $e->getMessage()); } @@ -140,31 +134,30 @@ class SetupWizardController extends Controller // Set settings collect([ [ - 'name' => 'stripe_currency', + 'name' => 'stripe_currency', 'value' => $request->currency, ], [ - 'name' => 'payments_configured', + 'name' => 'payments_configured', 'value' => 1, ], [ - 'name' => 'payments_active', + 'name' => 'payments_active', 'value' => 1, ], ])->each(function ($col) { Setting::forceCreate([ - 'name' => $col['name'], + 'name' => $col['name'], 'value' => $col['value'], ]); }); - if (!app()->runningUnitTests()) { - + if (! app()->runningUnitTests()) { // Set stripe credentials to .env setEnvironmentValue([ - 'CASHIER_CURRENCY' => $request->currency, - 'STRIPE_KEY' => $request->key, - 'STRIPE_SECRET' => $request->secret, + 'CASHIER_CURRENCY' => $request->currency, + 'STRIPE_KEY' => $request->key, + 'STRIPE_SECRET' => $request->secret, 'STRIPE_WEBHOOK_SECRET' => $request->webhookSecret, ]); @@ -186,45 +179,45 @@ class SetupWizardController extends Controller // Get options collect([ [ - 'name' => 'billing_phone_number', + 'name' => 'billing_phone_number', 'value' => $request->billing_phone_number, ], [ - 'name' => 'billing_postal_code', + 'name' => 'billing_postal_code', 'value' => $request->billing_postal_code, ], [ - 'name' => 'billing_vat_number', + 'name' => 'billing_vat_number', 'value' => $request->billing_vat_number, ], [ - 'name' => 'billing_address', + 'name' => 'billing_address', 'value' => $request->billing_address, ], [ - 'name' => 'billing_country', + 'name' => 'billing_country', 'value' => $request->billing_country, ], [ - 'name' => 'billing_state', + 'name' => 'billing_state', 'value' => $request->billing_state, ], [ - 'name' => 'billing_city', + 'name' => 'billing_city', 'value' => $request->billing_city, ], [ - 'name' => 'billing_name', + 'name' => 'billing_name', 'value' => $request->billing_name, ], ])->each(function ($col) { Setting::forceCreate([ - 'name' => $col['name'], + 'name' => $col['name'], 'value' => $col['value'], ]); }); - if (!app()->runningUnitTests()) { + if (! app()->runningUnitTests()) { Artisan::call('config:cache'); } @@ -254,42 +247,41 @@ class SetupWizardController extends Controller */ public function store_environment_setup(StoreEnvironmentSetupRequest $request) { - if (!app()->runningUnitTests()) { - + if (! app()->runningUnitTests()) { $drivers = [ - 'local' => [ + 'local' => [ 'FILESYSTEM_DRIVER' => 'local', ], - 's3' => [ - 'FILESYSTEM_DRIVER' => $request->storage['driver'] ?? null, - 'AWS_ACCESS_KEY_ID' => $request->storage['key'] ?? null, - 'AWS_SECRET_ACCESS_KEY' => $request->storage['secret'] ?? null, - 'AWS_DEFAULT_REGION' => $request->storage['region'] ?? null, - 'AWS_BUCKET' => $request->storage['bucket'] ?? null, - ], - 'spaces' => [ - 'FILESYSTEM_DRIVER' => $request->storage['driver'] ?? null, - 'DO_SPACES_KEY' => $request->storage['key'] ?? null, - 'DO_SPACES_SECRET' => $request->storage['secret'] ?? null, - 'DO_SPACES_ENDPOINT' => $request->storage['endpoint'] ?? null, - 'DO_SPACES_REGION' => $request->storage['region'] ?? null, - 'DO_SPACES_BUCKET' => $request->storage['bucket'] ?? null, - ], - 'wasabi' => [ + 's3' => [ 'FILESYSTEM_DRIVER' => $request->storage['driver'] ?? null, - 'WASABI_KEY' => $request->storage['key'] ?? null, - 'WASABI_SECRET' => $request->storage['secret'] ?? null, - 'WASABI_ENDPOINT' => $request->storage['endpoint'] ?? null, - 'WASABI_REGION' => $request->storage['region'] ?? null, - 'WASABI_BUCKET' => $request->storage['bucket'] ?? null, + 'AWS_ACCESS_KEY_ID' => $request->storage['key'] ?? null, + 'AWS_SECRET_ACCESS_KEY' => $request->storage['secret'] ?? null, + 'AWS_DEFAULT_REGION' => $request->storage['region'] ?? null, + 'AWS_BUCKET' => $request->storage['bucket'] ?? null, + ], + 'spaces' => [ + 'FILESYSTEM_DRIVER' => $request->storage['driver'] ?? null, + 'DO_SPACES_KEY' => $request->storage['key'] ?? null, + 'DO_SPACES_SECRET' => $request->storage['secret'] ?? null, + 'DO_SPACES_ENDPOINT' => $request->storage['endpoint'] ?? null, + 'DO_SPACES_REGION' => $request->storage['region'] ?? null, + 'DO_SPACES_BUCKET' => $request->storage['bucket'] ?? null, + ], + 'wasabi' => [ + 'FILESYSTEM_DRIVER' => $request->storage['driver'] ?? null, + 'WASABI_KEY' => $request->storage['key'] ?? null, + 'WASABI_SECRET' => $request->storage['secret'] ?? null, + 'WASABI_ENDPOINT' => $request->storage['endpoint'] ?? null, + 'WASABI_REGION' => $request->storage['region'] ?? null, + 'WASABI_BUCKET' => $request->storage['bucket'] ?? null, ], 'backblaze' => [ - 'FILESYSTEM_DRIVER' => $request->storage['driver'] ?? null, - 'BACKBLAZE_KEY' => $request->storage['key'] ?? null, - 'BACKBLAZE_SECRET' => $request->storage['secret'] ?? null, + 'FILESYSTEM_DRIVER' => $request->storage['driver'] ?? null, + 'BACKBLAZE_KEY' => $request->storage['key'] ?? null, + 'BACKBLAZE_SECRET' => $request->storage['secret'] ?? null, 'BACKBLAZE_ENDPOINT' => $request->storage['endpoint'] ?? null, - 'BACKBLAZE_REGION' => $request->storage['region'] ?? null, - 'BACKBLAZE_BUCKET' => $request->storage['bucket'] ?? null, + 'BACKBLAZE_REGION' => $request->storage['region'] ?? null, + 'BACKBLAZE_BUCKET' => $request->storage['bucket'] ?? null, ], ]; @@ -301,18 +293,17 @@ class SetupWizardController extends Controller // Store credentials for mail // TODO: add options for mailgun setEnvironmentValue([ - 'MAIL_DRIVER' => $request->mail['driver'], - 'MAIL_HOST' => $request->mail['host'], - 'MAIL_PORT' => $request->mail['port'], - 'MAIL_USERNAME' => $request->mail['username'], - 'MAIL_PASSWORD' => $request->mail['password'], + 'MAIL_DRIVER' => $request->mail['driver'], + 'MAIL_HOST' => $request->mail['host'], + 'MAIL_PORT' => $request->mail['port'], + 'MAIL_USERNAME' => $request->mail['username'], + 'MAIL_PASSWORD' => $request->mail['password'], 'MAIL_ENCRYPTION' => $request->mail['encryption'], ]); Artisan::call('config:cache'); } - return response('Done', 204); } @@ -326,61 +317,61 @@ class SetupWizardController extends Controller // Get options collect([ [ - 'name' => 'app_title', + 'name' => 'app_title', 'value' => $request->title, ], [ - 'name' => 'app_description', + 'name' => 'app_description', 'value' => $request->description, ], [ - 'name' => 'app_logo', + 'name' => 'app_logo', 'value' => store_system_image($request, 'logo'), ], [ - 'name' => 'app_logo_horizontal', + 'name' => 'app_logo_horizontal', 'value' => store_system_image($request, 'logo_horizontal'), ], [ - 'name' => 'app_favicon', + 'name' => 'app_favicon', 'value' => store_system_image($request, 'favicon'), ], [ - 'name' => 'app_og_image', + 'name' => 'app_og_image', 'value' => store_system_image($request, 'og_image'), ], [ - 'name' => 'app_touch_icon', + 'name' => 'app_touch_icon', 'value' => store_system_image($request, 'touch_icon'), ], [ - 'name' => 'google_analytics', + 'name' => 'google_analytics', 'value' => $request->googleAnalytics, ], [ - 'name' => 'contact_email', + 'name' => 'contact_email', 'value' => $request->contactMail, ], [ - 'name' => 'registration', + 'name' => 'registration', 'value' => $request->userRegistration, ], [ - 'name' => 'storage_limitation', + 'name' => 'storage_limitation', 'value' => $request->storageLimitation, ], [ - 'name' => 'storage_default', + 'name' => 'storage_default', 'value' => $request->defaultStorage ?? 5, ], ])->each(function ($col) { Setting::forceCreate([ - 'name' => $col['name'], + 'name' => $col['name'], 'value' => $col['value'], ]); }); - if (!app()->runningUnitTests()) { + if (! app()->runningUnitTests()) { setEnvironmentValue([ 'APP_NAME' => Str::camel($request->title), ]); @@ -400,18 +391,18 @@ class SetupWizardController extends Controller // Validate request // TODO: validator do requestu $request->validate([ - 'email' => 'required|string|email|unique:users', - 'password' => 'required|string|min:6|confirmed', - 'name' => 'required|string', + 'email' => 'required|string|email|unique:users', + 'password' => 'required|string|min:6|confirmed', + 'name' => 'required|string', 'purchase_code' => 'required|string', - 'license' => 'required|string', - 'avatar' => 'sometimes|file', + 'license' => 'required|string', + 'avatar' => 'sometimes|file', ]); // Create user $user = User::forceCreate([ - 'role' => 'admin', - 'email' => $request->email, + 'role' => 'admin', + 'email' => $request->email, 'password' => bcrypt($request->password), ]); @@ -419,26 +410,26 @@ class SetupWizardController extends Controller ->settings() ->create([ 'storage_capacity' => get_setting('storage_default') ?? 5, - 'avatar' => store_avatar($request, 'avatar'), - 'name' => $request->name, + 'avatar' => store_avatar($request, 'avatar'), + 'name' => $request->name, ]); collect([ [ - 'name' => 'setup_wizard_success', + 'name' => 'setup_wizard_success', 'value' => 1, ], [ - 'name' => 'license', + 'name' => 'license', 'value' => $request->license, ], [ - 'name' => 'purchase_code', + 'name' => 'purchase_code', 'value' => $request->purchase_code, - ] + ], ])->each(function ($col) { Setting::forceCreate([ - 'name' => $col['name'], + 'name' => $col['name'], 'value' => $col['value'], ]); }); @@ -450,7 +441,6 @@ class SetupWizardController extends Controller // Login account if (Auth::attempt($request->only(['email', 'password']))) { - $request->session()->regenerate(); return response('Registration was successful', 204); @@ -474,9 +464,7 @@ class SetupWizardController extends Controller if (Schema::hasTable('settings') && get_setting('setup_wizard_success')) { abort(410, 'Gone'); } - } catch (PDOException $e) { - return false; } } diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index 99a9aaa5..1e0bd482 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -1,14 +1,12 @@ $user->settings->name, + 'name' => $user->settings->name, 'avatar' => $user->settings->avatar, ]; } diff --git a/app/Http/Controllers/Auth/ConfirmPasswordController.php b/app/Http/Controllers/Auth/ConfirmPasswordController.php index 138c1f08..8711f04b 100644 --- a/app/Http/Controllers/Auth/ConfirmPasswordController.php +++ b/app/Http/Controllers/Auth/ConfirmPasswordController.php @@ -1,5 +1,4 @@ Lang::get($response)]); } @@ -53,7 +50,6 @@ class ResetPasswordController extends Controller */ protected function sendResetFailedResponse(Request $request, $response) { - return response(['error' => Lang::get($response)], 422); } } diff --git a/app/Http/Controllers/Auth/VerificationController.php b/app/Http/Controllers/Auth/VerificationController.php index 5e749af8..53185726 100644 --- a/app/Http/Controllers/Auth/VerificationController.php +++ b/app/Http/Controllers/Auth/VerificationController.php @@ -1,5 +1,4 @@ query('trash')) { - // Get folders and files $folders = Folder::onlyTrashed() ->with('parent') @@ -105,7 +103,7 @@ class BrowseController extends Controller $files_trashed = File::onlyTrashed() ->with(['parent']) ->where('user_id', $user_id) - ->where(function($query) use ($folders_trashed) { + ->where(function ($query) use ($folders_trashed) { $query->whereNull('folder_id'); $query->orWhereNotIn('folder_id', array_values(array_unique(recursiveFind($folders_trashed->toArray(), 'id')))); }) @@ -182,10 +180,10 @@ class BrowseController extends Controller return [ [ - 'name' => __t('home'), - 'location' => 'base', - 'folders' => $folders, - ] + 'name' => __t('home'), + 'location' => 'base', + 'folders' => $folders, + ], ]; } diff --git a/app/Http/Controllers/FileManager/EditItemsController.php b/app/Http/Controllers/FileManager/EditItemsController.php index bc1df508..009558f0 100644 --- a/app/Http/Controllers/FileManager/EditItemsController.php +++ b/app/Http/Controllers/FileManager/EditItemsController.php @@ -1,24 +1,22 @@ where('id', $id); - if (!$folder->exists()) { + if (! $folder->exists()) { abort(404, "Requested folder doesn't exists."); } $zip = $this->filemanager->zip_folder($id); return response([ - 'url' => route('zip', $zip->id), + 'url' => route('zip', $zip->id), 'name' => $zip->basename, ], 201); } @@ -161,8 +159,8 @@ class EditItemsController extends Controller $zip = $this->filemanager->zip_files($files); return response([ - 'url' => route('zip', $zip->id), + 'url' => route('zip', $zip->id), 'name' => $zip->basename, ], 201); } -} \ No newline at end of file +} diff --git a/app/Http/Controllers/FileManager/FavouriteController.php b/app/Http/Controllers/FileManager/FavouriteController.php index 5f4f75ab..72d8e458 100644 --- a/app/Http/Controllers/FileManager/FavouriteController.php +++ b/app/Http/Controllers/FileManager/FavouriteController.php @@ -1,13 +1,12 @@ folders as $id) { - // Get user & folder $user = Auth::user(); diff --git a/app/Http/Controllers/FileManager/FileAccessController.php b/app/Http/Controllers/FileManager/FileAccessController.php index 438f855f..b499984f 100644 --- a/app/Http/Controllers/FileManager/FileAccessController.php +++ b/app/Http/Controllers/FileManager/FileAccessController.php @@ -1,13 +1,12 @@ check_file_access($shared, $file); }*/ - // Store user download size $request->user()->record_download( - (int)$file->getRawOriginal('filesize') + (int) $file->getRawOriginal('filesize') ); return $this->helper->download_file($file, Auth::id()); @@ -111,11 +109,11 @@ class FileAccessController extends Controller ); return $disk->download("zip/$zip->basename", $zip->basename, [ - "Content-Type" => 'application/zip', - "Content-Length" => $disk->size("zip/$zip->basename"), - "Accept-Ranges" => "bytes", - "Content-Range" => "bytes 0-600/" . $disk->size("zip/$zip->basename"), - "Content-Disposition" => "attachment; filename=$zip->basename", + 'Content-Type' => 'application/zip', + 'Content-Length' => $disk->size("zip/$zip->basename"), + 'Accept-Ranges' => 'bytes', + 'Content-Range' => 'bytes 0-600/' . $disk->size("zip/$zip->basename"), + 'Content-Disposition' => "attachment; filename=$zip->basename", ]); } diff --git a/app/Http/Controllers/FileManager/ShareController.php b/app/Http/Controllers/FileManager/ShareController.php index 843fa67c..53791e9c 100644 --- a/app/Http/Controllers/FileManager/ShareController.php +++ b/app/Http/Controllers/FileManager/ShareController.php @@ -1,19 +1,18 @@ $request->has('password') ? bcrypt($request->password) : null, - 'type' => $request->type === 'folder' ? 'folder' : 'file', + 'password' => $request->has('password') ? bcrypt($request->password) : null, + 'type' => $request->type === 'folder' ? 'folder' : 'file', 'is_protected' => $request->isPassword, - 'permission' => $request->permission ?? null, - 'item_id' => $id, - 'expire_in' => $request->expiration ?? null, - 'user_id' => Auth::id(), + 'permission' => $request->permission ?? null, + 'item_id' => $id, + 'expire_in' => $request->expiration ?? null, + 'user_id' => Auth::id(), ]); // Send shared link via email if ($request->has('emails')) { - foreach ($request->emails as $email) { - Notification::route('mail', $email)->notify( new SharedSendViaEmail($shared->token) ); @@ -81,10 +78,10 @@ class ShareController extends Controller // Update sharing record $shared->update([ - 'permission' => $request->permission, + 'permission' => $request->permission, 'is_protected' => $request->protected, - 'expire_in' => $request->expiration, - 'password' => $request->password ? bcrypt($request->password) : $shared->password, + 'expire_in' => $request->expiration, + 'password' => $request->password ? bcrypt($request->password) : $shared->password, ]); // Return shared record @@ -100,7 +97,6 @@ class ShareController extends Controller public function destroy(Request $request) { foreach ($request->tokens as $token) { - // Get sharing record Share::where('token', $token) ->where('user_id', Auth::id()) @@ -141,7 +137,6 @@ class ShareController extends Controller // Send shared link via email if ($request->has('emails')) { - foreach ($request->emails as $email) { Notification::route('mail', $email) ->notify(new SharedSendViaEmail($token)); diff --git a/app/Http/Controllers/FileManager/TrashController.php b/app/Http/Controllers/FileManager/TrashController.php index 26589bf7..59d7612c 100644 --- a/app/Http/Controllers/FileManager/TrashController.php +++ b/app/Http/Controllers/FileManager/TrashController.php @@ -1,16 +1,15 @@ input('items'), [ '*.type' => 'required|string', - '*.id' => 'string', + '*.id' => 'string', ]); // Return error - if ($validator->fails()) abort(400, 'Bad input'); + if ($validator->fails()) { + abort(400, 'Bad input'); + } // Get user id $user_id = Auth::id(); @@ -46,10 +47,8 @@ class TrashController extends Controller abort_if(is_demo_account('howdy@hi5ve.digital'), 204, 'Done.'); foreach ($request->input('items') as $restore) { - // Get folder if ($restore['type'] === 'folder') { - // Get folder $item = Folder::onlyTrashed() ->where('user_id', $user_id) @@ -62,7 +61,6 @@ class TrashController extends Controller $item->save(); } } else { - // Get item $item = File::onlyTrashed() ->where('user_id', $user_id) @@ -105,7 +103,6 @@ class TrashController extends Controller // Force delete files foreach ($files as $file) { - // Delete file Storage::delete("/files/$user_id/{$file->basename}"); diff --git a/app/Http/Controllers/Sharing/BrowseShareController.php b/app/Http/Controllers/Sharing/BrowseShareController.php index 45e1adc4..285a337d 100644 --- a/app/Http/Controllers/Sharing/BrowseShareController.php +++ b/app/Http/Controllers/Sharing/BrowseShareController.php @@ -1,20 +1,19 @@ type === 'file' && !$shared->is_protected) { - + if ($shared->type === 'file' && ! $shared->is_protected) { $image = File::whereUserId($shared->user_id) ->whereType('image') ->whereId($shared->item_id) ->first(); if ($image) { - // Store user download size $shared ->user ->record_download( - (int)$image->getRawOriginal('filesize') + (int) $image->getRawOriginal('filesize') ); return $this->get_single_image($image, $shared->user_id); } } - return view("index") + return view('index') ->with('installation', 'setup-done') ->with('settings', get_settings_in_json() ?? null); } @@ -74,9 +71,8 @@ class BrowseShareController extends Controller { // Check password if (Hash::check($request->password, $shared->password)) { - $cookie = json_encode([ - 'token' => $shared->token, + 'token' => $shared->token, 'authenticated' => true, ]); @@ -151,7 +147,6 @@ class BrowseShareController extends Controller // Filter files $files = $searched_files->filter(function ($file) use ($accessible_folder_ids, $shared) { - // Set public urls $file->setPublicUrl($shared->token); @@ -161,7 +156,6 @@ class BrowseShareController extends Controller // Filter folders $folders = $searched_folders->filter(function ($folder) use ($accessible_folder_ids) { - // check if item is in accessible folders return in_array($folder->id, $accessible_folder_ids); }); @@ -194,11 +188,11 @@ class BrowseShareController extends Controller return [ [ - 'id' => $shared->item_id, - 'name' => __t('home'), + 'id' => $shared->item_id, + 'name' => __t('home'), 'location' => 'public', - 'folders' => $folders, - ] + 'folders' => $folders, + ], ]; } @@ -240,13 +234,15 @@ class BrowseShareController extends Controller $path = "/files/$user_id/$file->basename"; // Check if file exist - if (!Storage::exists($path)) abort(404); + if (! Storage::exists($path)) { + abort(404); + } return Storage::response($path, $file_pretty_name, [ - "Content-Type" => Storage::mimeType($path), - "Content-Length" => Storage::size($path), - "Accept-Ranges" => "bytes", - "Content-Range" => "bytes 0-600/" . Storage::size($path), + 'Content-Type' => Storage::mimeType($path), + 'Content-Length' => Storage::size($path), + 'Accept-Ranges' => 'bytes', + 'Content-Range' => 'bytes 0-600/' . Storage::size($path), ]); } } diff --git a/app/Http/Controllers/Sharing/FileSharedAccessController.php b/app/Http/Controllers/Sharing/FileSharedAccessController.php index 3cbb9bd7..71edb851 100644 --- a/app/Http/Controllers/Sharing/FileSharedAccessController.php +++ b/app/Http/Controllers/Sharing/FileSharedAccessController.php @@ -1,13 +1,11 @@ download("zip/$zip->basename", $zip->basename, [ - "Content-Type" => 'application/zip', - "Content-Length" => $disk->size("zip/$zip->basename"), - "Accept-Ranges" => "bytes", - "Content-Range" => "bytes 0-600/" . $disk->size("zip/$zip->basename"), - "Content-Disposition" => "attachment; filename=" . $zip->basename, + 'Content-Type' => 'application/zip', + 'Content-Length' => $disk->size("zip/$zip->basename"), + 'Accept-Ranges' => 'bytes', + 'Content-Range' => 'bytes 0-600/' . $disk->size("zip/$zip->basename"), + 'Content-Disposition' => 'attachment; filename=' . $zip->basename, ]); } @@ -74,7 +72,7 @@ class FileSharedAccessController extends Controller $shared ->user ->record_download( - (int)$file->getRawOriginal('filesize') + (int) $file->getRawOriginal('filesize') ); return $this->helper->download_file($file, $shared->user_id); @@ -104,7 +102,7 @@ class FileSharedAccessController extends Controller $shared ->user ->record_download( - (int)$file->getRawOriginal('filesize') + (int) $file->getRawOriginal('filesize') ); return $this->helper->download_thumbnail_file($file, $shared->user_id); diff --git a/app/Http/Controllers/Sharing/ManipulateShareItemsController.php b/app/Http/Controllers/Sharing/ManipulateShareItemsController.php index c5fd8d91..257bf184 100644 --- a/app/Http/Controllers/Sharing/ManipulateShareItemsController.php +++ b/app/Http/Controllers/Sharing/ManipulateShareItemsController.php @@ -1,23 +1,21 @@ user->email), 204, 'Done.'); - // Check ability to access protected share record $this->helper->check_protected_share_record($shared); @@ -133,7 +130,6 @@ class ManipulateShareItemsController extends Controller } foreach ($request->items as $file) { - // Get file|folder item $item = get_item($file['type'], $file['id']); @@ -205,22 +201,19 @@ class ManipulateShareItemsController extends Controller } foreach ($request->items as $item) { - if ($item['type'] === 'folder') { - $this->helper->check_item_access([ - $request->to_id, $item['id'] + $request->to_id, $item['id'], ], $shared); } if ($item['type'] !== 'folder') { - $file = File::where('id', $item['id']) ->where('user_id', $shared->user_id) ->firstOrFail(); $this->helper->check_item_access([ - $request->to_id, $file->folder_id + $request->to_id, $file->folder_id, ], $shared); } } @@ -250,7 +243,7 @@ class ManipulateShareItemsController extends Controller $folder = Folder::whereUserId($shared->user_id) ->where('id', $id); - if (!$folder->exists()) { + if (! $folder->exists()) { abort(404, 'Requested folder doesn\'t exists.'); } @@ -258,8 +251,8 @@ class ManipulateShareItemsController extends Controller // Get file return response([ - 'url' => route('zip_public', [ - 'id' => $zip->id, + 'url' => route('zip_public', [ + 'id' => $zip->id, 'token' => $shared->token, ]), 'name' => $zip->basename, @@ -297,8 +290,8 @@ class ManipulateShareItemsController extends Controller // Get file return response([ - 'url' => route('zip_public', [ - 'id' => $zip->id, + 'url' => route('zip_public', [ + 'id' => $zip->id, 'token' => $shared->token, ]), 'name' => $zip->basename, diff --git a/app/Http/Controllers/Subscription/StripeWebhookController.php b/app/Http/Controllers/Subscription/StripeWebhookController.php index ccc01340..1d780ce2 100644 --- a/app/Http/Controllers/Subscription/StripeWebhookController.php +++ b/app/Http/Controllers/Subscription/StripeWebhookController.php @@ -1,11 +1,8 @@ settings() ->update([ - 'storage_capacity' => get_setting('storage_default') + 'storage_capacity' => get_setting('storage_default'), ]); return $this->successMethod(); @@ -64,7 +61,7 @@ class StripeWebhookController extends CashierController $user ->settings() ->update([ - 'storage_capacity' => $plan['product']['metadata']['capacity'] + 'storage_capacity' => $plan['product']['metadata']['capacity'], ]); return $this->successMethod(); diff --git a/app/Http/Controllers/User/AccountController.php b/app/Http/Controllers/User/AccountController.php index f995ae04..d1ae08bf 100644 --- a/app/Http/Controllers/User/AccountController.php +++ b/app/Http/Controllers/User/AccountController.php @@ -1,18 +1,16 @@ all(), [ 'avatar' => 'sometimes|file', - 'name' => 'string', - 'value' => 'string', + 'name' => 'string', + 'value' => 'string', ]); // Return error - if ($validator->fails()) abort(400, 'Bad input'); + if ($validator->fails()) { + abort(400, 'Bad input'); + } // Get user $user = Auth::user(); @@ -90,7 +90,7 @@ class AccountController extends Controller $user ->settings() ->update([ - 'avatar' => store_avatar($request, 'avatar') + 'avatar' => store_avatar($request, 'avatar'), ]); return response('Saved!', 204); diff --git a/app/Http/Controllers/User/PaymentMethodsController.php b/app/Http/Controllers/User/PaymentMethodsController.php index d70bf1b1..6158079e 100644 --- a/app/Http/Controllers/User/PaymentMethodsController.php +++ b/app/Http/Controllers/User/PaymentMethodsController.php @@ -1,22 +1,20 @@ stripe = $stripe; @@ -32,7 +30,7 @@ class PaymentMethodsController extends Controller { $user = Auth::user(); - if (!$user->hasPaymentMethod()) { + if (! $user->hasPaymentMethod()) { return abort(204, 'User don\'t have any payment methods'); } @@ -40,15 +38,11 @@ class PaymentMethodsController extends Controller $slug_default_payment_method = 'default-payment-methods-user-' . $user->id; if (Cache::has($slug_payment_methods) && Cache::has($slug_default_payment_method)) { - $defaultPaymentMethod = Cache::get($slug_default_payment_method); $paymentMethodsMapped = Cache::get($slug_payment_methods); - } else { - // Get default payment method $defaultPaymentMethod = Cache::rememberForever($slug_default_payment_method, function () use ($user) { - $defaultPaymentMethodObject = $user->defaultPaymentMethod(); return $defaultPaymentMethodObject instanceof PaymentMethod @@ -58,7 +52,6 @@ class PaymentMethodsController extends Controller // filter payment methods without default payment $paymentMethodsMapped = Cache::rememberForever($slug_payment_methods, function () use ($defaultPaymentMethod, $user) { - $paymentMethods = $user->paymentMethods()->filter(function ($paymentMethod) use ($defaultPaymentMethod) { return $paymentMethod->id !== $defaultPaymentMethod->id; }); @@ -70,10 +63,10 @@ class PaymentMethodsController extends Controller }); } - if (!$user->card_brand || !$user->stripe_id || is_null($paymentMethodsMapped) && is_null($paymentMethodsMapped)) { + if (! $user->card_brand || ! $user->stripe_id || is_null($paymentMethodsMapped) && is_null($paymentMethodsMapped)) { return [ 'default' => null, - 'others' => [], + 'others' => [], ]; } @@ -81,7 +74,7 @@ class PaymentMethodsController extends Controller 'default' => $defaultPaymentMethod instanceof PaymentMethod ? new PaymentCardResource($defaultPaymentMethod) : new PaymentDefaultCardResource($defaultPaymentMethod), - 'others' => new PaymentCardCollection($paymentMethodsMapped), + 'others' => new PaymentCardCollection($paymentMethodsMapped), ]; } @@ -108,7 +101,7 @@ class PaymentMethodsController extends Controller // Clear cached payment methods cache_forget_many([ 'payment-methods-user-' . $user->id, - 'default-payment-methods-user-' . $user->id + 'default-payment-methods-user-' . $user->id, ]); return response('Done', 204); @@ -159,7 +152,7 @@ class PaymentMethodsController extends Controller // Clear cached payment methods cache_forget_many([ 'payment-methods-user-' . $user->id, - 'default-payment-methods-user-' . $user->id + 'default-payment-methods-user-' . $user->id, ]); return response('Done!', 204); diff --git a/app/Http/Controllers/User/SubscriptionController.php b/app/Http/Controllers/User/SubscriptionController.php index c7c94771..90d66ccc 100644 --- a/app/Http/Controllers/User/SubscriptionController.php +++ b/app/Http/Controllers/User/SubscriptionController.php @@ -1,19 +1,18 @@ stripe->getSetupIntent(Auth::user()), 201 + $this->stripe->getSetupIntent(Auth::user()), + 201 ); } @@ -47,7 +47,7 @@ class SubscriptionController extends Controller { $user = User::find(Auth::id()); - if (!$user->subscription('main')) { + if (! $user->subscription('main')) { return abort(204, 'User don\'t have any subscription'); } @@ -97,7 +97,7 @@ class SubscriptionController extends Controller // Update user storage limit $user->settings()->update([ - 'storage_capacity' => $plan['product']['metadata']['capacity'] + 'storage_capacity' => $plan['product']['metadata']['capacity'], ]); return response('Done!', 204); diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 41f9652d..6e4a5bac 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -1,5 +1,4 @@ 'required|array', - 'attributes.role' => 'required|string' + 'attributes' => 'required|array', + 'attributes.role' => 'required|string', ]; } } diff --git a/app/Http/Requests/Admin/ChangeStorageCapacityRequest.php b/app/Http/Requests/Admin/ChangeStorageCapacityRequest.php index d0be286b..40c89f52 100644 --- a/app/Http/Requests/Admin/ChangeStorageCapacityRequest.php +++ b/app/Http/Requests/Admin/ChangeStorageCapacityRequest.php @@ -1,5 +1,4 @@ 'required|array', - 'attributes.storage_capacity' => 'required|digits_between:1,9' + 'attributes' => 'required|array', + 'attributes.storage_capacity' => 'required|digits_between:1,9', ]; } } diff --git a/app/Http/Requests/Admin/CreateUserByAdmin.php b/app/Http/Requests/Admin/CreateUserByAdmin.php index c4a1d677..6d7bdd65 100644 --- a/app/Http/Requests/Admin/CreateUserByAdmin.php +++ b/app/Http/Requests/Admin/CreateUserByAdmin.php @@ -1,5 +1,4 @@ 'required|string|email|max:255|unique:users', - 'password' => 'required|string|min:6|confirmed', - 'name' => 'required|string|max:255', + 'email' => 'required|string|email|max:255|unique:users', + 'password' => 'required|string|min:6|confirmed', + 'name' => 'required|string|max:255', 'storage_capacity' => 'required|digits_between:1,9', - 'role' => 'required|string', - 'avatar' => 'sometimes|file', + 'role' => 'required|string', + 'avatar' => 'sometimes|file', ]; } } diff --git a/app/Http/Requests/Admin/DeleteUserRequest.php b/app/Http/Requests/Admin/DeleteUserRequest.php index 760823b2..93247c0c 100644 --- a/app/Http/Requests/Admin/DeleteUserRequest.php +++ b/app/Http/Requests/Admin/DeleteUserRequest.php @@ -1,5 +1,4 @@ 'nullable|uuid', - 'name' => 'required|string', + 'name' => 'required|string', ]; } } diff --git a/app/Http/Requests/FileFunctions/DeleteItemRequest.php b/app/Http/Requests/FileFunctions/DeleteItemRequest.php index fbb9b486..209d3b11 100644 --- a/app/Http/Requests/FileFunctions/DeleteItemRequest.php +++ b/app/Http/Requests/FileFunctions/DeleteItemRequest.php @@ -1,9 +1,7 @@ 'required|boolean', - 'data[*].type' => 'required|string', - 'data[*].id' => 'required|integer' + 'data[*].type' => 'required|string', + 'data[*].id' => 'required|integer', ]; } } diff --git a/app/Http/Requests/FileFunctions/MoveItemRequest.php b/app/Http/Requests/FileFunctions/MoveItemRequest.php index 8b337444..8ccd3108 100644 --- a/app/Http/Requests/FileFunctions/MoveItemRequest.php +++ b/app/Http/Requests/FileFunctions/MoveItemRequest.php @@ -1,9 +1,7 @@ 'nullable|uuid', + 'to_id' => 'nullable|uuid', 'items[*].type' => 'required|string', - 'items[*].id' => 'required|uuid', + 'items[*].id' => 'required|uuid', ]; } } diff --git a/app/Http/Requests/FileFunctions/RenameItemRequest.php b/app/Http/Requests/FileFunctions/RenameItemRequest.php index 865fda41..a285d334 100644 --- a/app/Http/Requests/FileFunctions/RenameItemRequest.php +++ b/app/Http/Requests/FileFunctions/RenameItemRequest.php @@ -1,9 +1,7 @@ 'required|string', - 'type' => 'required|string', + 'name' => 'required|string', + 'type' => 'required|string', ]; } } diff --git a/app/Http/Requests/FileFunctions/UploadRequest.php b/app/Http/Requests/FileFunctions/UploadRequest.php index 08579000..b1dc31e8 100644 --- a/app/Http/Requests/FileFunctions/UploadRequest.php +++ b/app/Http/Requests/FileFunctions/UploadRequest.php @@ -1,5 +1,4 @@ 'nullable|uuid', - 'file' => ['required', 'file', new DisabledMimetypes] + 'file' => ['required', 'file', new DisabledMimetypes], ]; } } diff --git a/app/Http/Requests/Languages/CreateLanguageRequest.php b/app/Http/Requests/Languages/CreateLanguageRequest.php index 493d3225..ed35c44a 100644 --- a/app/Http/Requests/Languages/CreateLanguageRequest.php +++ b/app/Http/Requests/Languages/CreateLanguageRequest.php @@ -1,5 +1,4 @@ 'required|string', - 'locale' => 'required|string' + 'locale' => 'required|string', ]; } } diff --git a/app/Http/Requests/Languages/UpdateLanguageRequest.php b/app/Http/Requests/Languages/UpdateLanguageRequest.php index 8a825fb4..056af6d5 100644 --- a/app/Http/Requests/Languages/UpdateLanguageRequest.php +++ b/app/Http/Requests/Languages/UpdateLanguageRequest.php @@ -1,5 +1,4 @@ 'required|string', - 'value' => 'required|string' + 'name' => 'required|string', + 'value' => 'required|string', ]; } } diff --git a/app/Http/Requests/Languages/UpdateStringRequest.php b/app/Http/Requests/Languages/UpdateStringRequest.php index 3e4c61e0..c4052362 100644 --- a/app/Http/Requests/Languages/UpdateStringRequest.php +++ b/app/Http/Requests/Languages/UpdateStringRequest.php @@ -1,5 +1,4 @@ 'required|string', - 'value' => 'required|string' + 'name' => 'required|string', + 'value' => 'required|string', ]; } } diff --git a/app/Http/Requests/Payments/RegisterNewPaymentMethodRequest.php b/app/Http/Requests/Payments/RegisterNewPaymentMethodRequest.php index ea8bccb4..6a998dd8 100644 --- a/app/Http/Requests/Payments/RegisterNewPaymentMethodRequest.php +++ b/app/Http/Requests/Payments/RegisterNewPaymentMethodRequest.php @@ -1,5 +1,4 @@ 'required|string', - 'default' => 'required|boolean' + 'token' => 'required|string', + 'default' => 'required|boolean', ]; } } diff --git a/app/Http/Requests/PublicPages/SendContactMessageRequest.php b/app/Http/Requests/PublicPages/SendContactMessageRequest.php index 416c1513..0bf18ea9 100644 --- a/app/Http/Requests/PublicPages/SendContactMessageRequest.php +++ b/app/Http/Requests/PublicPages/SendContactMessageRequest.php @@ -1,5 +1,4 @@ 'required|email', + 'email' => 'required|email', 'message' => 'required|string', ]; } diff --git a/app/Http/Requests/SetupWizard/StoreAppSetupRequest.php b/app/Http/Requests/SetupWizard/StoreAppSetupRequest.php index ac8f3baf..d689ded5 100644 --- a/app/Http/Requests/SetupWizard/StoreAppSetupRequest.php +++ b/app/Http/Requests/SetupWizard/StoreAppSetupRequest.php @@ -1,5 +1,4 @@ 'required|string', - 'description' => 'required|string', - 'logo' => 'sometimes|file', - 'logo_horizontal' => 'sometimes|file', - 'favicon' => 'sometimes|file', - 'contactMail' => 'required|email', - 'googleAnalytics' => 'sometimes|string', - 'defaultStorage' => 'sometimes|digits_between:1,9', - 'userRegistration' => 'required|boolean', + 'title' => 'required|string', + 'description' => 'required|string', + 'logo' => 'sometimes|file', + 'logo_horizontal' => 'sometimes|file', + 'favicon' => 'sometimes|file', + 'contactMail' => 'required|email', + 'googleAnalytics' => 'sometimes|string', + 'defaultStorage' => 'sometimes|digits_between:1,9', + 'userRegistration' => 'required|boolean', 'storageLimitation' => 'required|boolean', ]; } diff --git a/app/Http/Requests/SetupWizard/StoreDatabaseCredentialsRequest.php b/app/Http/Requests/SetupWizard/StoreDatabaseCredentialsRequest.php index c81fd16e..ce00328f 100644 --- a/app/Http/Requests/SetupWizard/StoreDatabaseCredentialsRequest.php +++ b/app/Http/Requests/SetupWizard/StoreDatabaseCredentialsRequest.php @@ -1,5 +1,4 @@ 'required|string', - 'host' => 'required|string', - 'port' => 'required|string', - 'name' => 'required|string', - 'username' => 'required|string', - 'password' => 'required|string', + 'host' => 'required|string', + 'port' => 'required|string', + 'name' => 'required|string', + 'username' => 'required|string', + 'password' => 'required|string', ]; } } diff --git a/app/Http/Requests/SetupWizard/StoreEnvironmentSetupRequest.php b/app/Http/Requests/SetupWizard/StoreEnvironmentSetupRequest.php index 5834d31d..1b4b3416 100644 --- a/app/Http/Requests/SetupWizard/StoreEnvironmentSetupRequest.php +++ b/app/Http/Requests/SetupWizard/StoreEnvironmentSetupRequest.php @@ -1,5 +1,4 @@ 'required|array', - 'storage.driver' => 'required|string', - 'storage.key' => 'sometimes|nullable|string', - 'storage.secret' => 'sometimes|nullable|string', + 'storage' => 'required|array', + 'storage.driver' => 'required|string', + 'storage.key' => 'sometimes|nullable|string', + 'storage.secret' => 'sometimes|nullable|string', 'storage.endpoint' => 'sometimes|nullable|string', - 'storage.region' => 'sometimes|nullable|string', - 'storage.bucket' => 'sometimes|nullable|string', - 'mail' => 'required|array', - 'mail.driver' => 'required|string', - 'mail.host' => 'required|string', - 'mail.port' => 'required|string', - 'mail.username' => 'required|string', - 'mail.password' => 'required|string', - 'mail.encryption' => 'required|string', + 'storage.region' => 'sometimes|nullable|string', + 'storage.bucket' => 'sometimes|nullable|string', + 'mail' => 'required|array', + 'mail.driver' => 'required|string', + 'mail.host' => 'required|string', + 'mail.port' => 'required|string', + 'mail.username' => 'required|string', + 'mail.password' => 'required|string', + 'mail.encryption' => 'required|string', ]; } } diff --git a/app/Http/Requests/SetupWizard/StoreStripeBillingRequest.php b/app/Http/Requests/SetupWizard/StoreStripeBillingRequest.php index 3b825a9f..44fe2524 100644 --- a/app/Http/Requests/SetupWizard/StoreStripeBillingRequest.php +++ b/app/Http/Requests/SetupWizard/StoreStripeBillingRequest.php @@ -1,5 +1,4 @@ 'sometimes|nullable|string', - 'billing_postal_code' => 'required|string', - 'billing_vat_number' => 'required|string', - 'billing_address' => 'required|string', - 'billing_country' => 'required|string', - 'billing_state' => 'required|string', - 'billing_city' => 'required|string', - 'billing_name' => 'required|string', + 'billing_postal_code' => 'required|string', + 'billing_vat_number' => 'required|string', + 'billing_address' => 'required|string', + 'billing_country' => 'required|string', + 'billing_state' => 'required|string', + 'billing_city' => 'required|string', + 'billing_name' => 'required|string', ]; } } diff --git a/app/Http/Requests/SetupWizard/StoreStripeCredentialsRequest.php b/app/Http/Requests/SetupWizard/StoreStripeCredentialsRequest.php index e6f81a88..30c173b2 100644 --- a/app/Http/Requests/SetupWizard/StoreStripeCredentialsRequest.php +++ b/app/Http/Requests/SetupWizard/StoreStripeCredentialsRequest.php @@ -1,5 +1,4 @@ 'required|string', + 'currency' => 'required|string', 'webhookSecret' => 'required|string', - 'secret' => 'required|string', - 'key' => 'required|string', + 'secret' => 'required|string', + 'key' => 'required|string', ]; } } diff --git a/app/Http/Requests/SetupWizard/StoreStripePlansRequest.php b/app/Http/Requests/SetupWizard/StoreStripePlansRequest.php index 5543fb35..239e693a 100644 --- a/app/Http/Requests/SetupWizard/StoreStripePlansRequest.php +++ b/app/Http/Requests/SetupWizard/StoreStripePlansRequest.php @@ -1,5 +1,4 @@ 'required|array', - 'plans.*.type' => 'required|string', - 'plans.*.attributes.name' => 'required|string', - 'plans.*.attributes.price' => 'required|string', + 'plans' => 'required|array', + 'plans.*.type' => 'required|string', + 'plans.*.attributes.name' => 'required|string', + 'plans.*.attributes.price' => 'required|string', 'plans.*.attributes.description' => 'sometimes|nullable|string', - 'plans.*.attributes.capacity' => 'required|digits_between:1,9', + 'plans.*.attributes.capacity' => 'required|digits_between:1,9', ]; } } diff --git a/app/Http/Requests/Share/AuthenticateShareRequest.php b/app/Http/Requests/Share/AuthenticateShareRequest.php index 0813ed7d..0e8de356 100644 --- a/app/Http/Requests/Share/AuthenticateShareRequest.php +++ b/app/Http/Requests/Share/AuthenticateShareRequest.php @@ -1,5 +1,4 @@ 'required|boolean', - 'type' => 'required|string', + 'type' => 'required|string', 'expiration' => 'integer|nullable', 'permission' => 'string', - 'password' => 'string', - 'emails.*' => 'email' + 'password' => 'string', + 'emails.*' => 'email', ]; } } diff --git a/app/Http/Requests/Share/UpdateShareRequest.php b/app/Http/Requests/Share/UpdateShareRequest.php index 03b9b447..72e52e07 100644 --- a/app/Http/Requests/Share/UpdateShareRequest.php +++ b/app/Http/Requests/Share/UpdateShareRequest.php @@ -1,9 +1,8 @@ 'required|boolean', + 'protected' => 'required|boolean', 'permission' => 'nullable|string', 'expiration' => 'integer|nullable', - 'password' => 'string', + 'password' => 'string', ]; } } diff --git a/app/Http/Requests/Subscription/StoreUpgradeAccountRequest.php b/app/Http/Requests/Subscription/StoreUpgradeAccountRequest.php index f768b9ad..99df8c59 100644 --- a/app/Http/Requests/Subscription/StoreUpgradeAccountRequest.php +++ b/app/Http/Requests/Subscription/StoreUpgradeAccountRequest.php @@ -1,5 +1,4 @@ 'required|array', - 'billing.billing_address' => 'required|string', - 'billing.billing_city' => 'required|string', - 'billing.billing_country' => 'required|string', - 'billing.billing_name' => 'required|string', - 'billing.billing_phone_number' => 'required|string', - 'billing.billing_postal_code' => 'required|string', - 'billing.billing_state' => 'required|string', + 'billing' => 'required|array', + 'billing.billing_address' => 'required|string', + 'billing.billing_city' => 'required|string', + 'billing.billing_country' => 'required|string', + 'billing.billing_name' => 'required|string', + 'billing.billing_phone_number' => 'required|string', + 'billing.billing_postal_code' => 'required|string', + 'billing.billing_state' => 'required|string', // Payment - 'payment' => 'required|array', - 'payment.type' => 'required|string', - 'payment.meta' => 'required|sometimes|array', - 'payment.meta.pm' => 'required|sometimes|string', + 'payment' => 'required|array', + 'payment.type' => 'required|string', + 'payment.meta' => 'required|sometimes|array', + 'payment.meta.pm' => 'required|sometimes|string', // Plan - 'plan.data' => 'required|array', - 'plan.data.attributes' => 'required|array', - 'plan.data.attributes.capacity' => 'required|digits_between:1,9', + 'plan.data' => 'required|array', + 'plan.data.attributes' => 'required|array', + 'plan.data.attributes.capacity' => 'required|digits_between:1,9', 'plan.data.attributes.capacity_formatted' => 'required|string', - 'plan.data.attributes.currency' => 'required|string', - 'plan.data.attributes.description' => 'sometimes|string|nullable', - 'plan.data.attributes.name' => 'required|string', - 'plan.data.attributes.price' => 'required|string', - 'plan.data.id' => 'required|string', - 'plan.data.type' => 'required|string', + 'plan.data.attributes.currency' => 'required|string', + 'plan.data.attributes.description' => 'sometimes|string|nullable', + 'plan.data.attributes.name' => 'required|string', + 'plan.data.attributes.price' => 'required|string', + 'plan.data.id' => 'required|string', + 'plan.data.type' => 'required|string', ]; } } diff --git a/app/Http/Requests/User/UpdateUserPasswordRequest.php b/app/Http/Requests/User/UpdateUserPasswordRequest.php index 6f4e82cb..1be7f2b6 100644 --- a/app/Http/Requests/User/UpdateUserPasswordRequest.php +++ b/app/Http/Requests/User/UpdateUserPasswordRequest.php @@ -1,5 +1,4 @@ [ - 'id' => $this->id, - 'type' => 'file', + 'id' => $this->id, + 'type' => 'file', 'attributes' => [ - 'name' => $this->name, - 'basename' => $this->basename, - 'mimetype' => $this->mimetype, - 'filesize' => $this->filesize, - 'type' => $this->type, - 'file_url' => $this->file_url, - 'thumbnail' => $this->thumbnail, + 'name' => $this->name, + 'basename' => $this->basename, + 'mimetype' => $this->mimetype, + 'filesize' => $this->filesize, + 'type' => $this->type, + 'file_url' => $this->file_url, + 'thumbnail' => $this->thumbnail, 'created_at' => $this->created_at, 'updated_at' => $this->created_at, - ] + ], ], ]; } diff --git a/app/Http/Resources/InvoiceAdminCollection.php b/app/Http/Resources/InvoiceAdminCollection.php index e461720d..584bce4b 100644 --- a/app/Http/Resources/InvoiceAdminCollection.php +++ b/app/Http/Resources/InvoiceAdminCollection.php @@ -1,5 +1,4 @@ [ - 'id' => $this['id'], - 'type' => 'invoices', + 'id' => $this['id'], + 'type' => 'invoices', 'attributes' => [ - 'customer' => $this['customer'], - 'total' => Cashier::formatAmount($this['total']), - 'currency' => $this['currency'], + 'customer' => $this['customer'], + 'total' => Cashier::formatAmount($this['total']), + 'currency' => $this['currency'], 'created_at_formatted' => format_date($this['created']), - 'created_at' => $this['created'], - 'order' => $this['number'], - 'user_id' => $user->id ?? null, - 'client' => [ - 'billing_address' => $this['customer_address'], - 'billing_name' => $this['customer_name'], + 'created_at' => $this['created'], + 'order' => $this['number'], + 'user_id' => $user->id ?? null, + 'client' => [ + 'billing_address' => $this['customer_address'], + 'billing_name' => $this['customer_name'], 'billing_phone_number' => $this['customer_phone'], ], - 'bag' => [ - 'amount' => $this['lines']['data'][0]['amount'], - 'currency' => $this['lines']['data'][0]['currency'], - 'type' => $this['lines']['data'][0]['type'], + 'bag' => [ + 'amount' => $this['lines']['data'][0]['amount'], + 'currency' => $this['lines']['data'][0]['currency'], + 'type' => $this['lines']['data'][0]['type'], 'description' => $this['lines']['data'][0]['description'], ], - 'seller' => null, + 'seller' => null, ], $this->mergeWhen($user, function () use ($user) { return [ 'relationships' => [ 'user' => [ 'data' => [ - 'id' => $user->id, - 'type' => 'user', + 'id' => $user->id, + 'type' => 'user', 'attributes' => [ - 'name' => $user->settings->name, + 'name' => $user->settings->name, 'avatar' => $user->settings->avatar, - ] - ] - ] - ] + ], + ], + ], + ], ]; }), ], diff --git a/app/Http/Resources/InvoiceCollection.php b/app/Http/Resources/InvoiceCollection.php index 947c39a0..71a5cd57 100644 --- a/app/Http/Resources/InvoiceCollection.php +++ b/app/Http/Resources/InvoiceCollection.php @@ -1,5 +1,4 @@ [ - 'id' => $this->id, - 'type' => 'invoices', + 'id' => $this->id, + 'type' => 'invoices', 'attributes' => [ - 'customer' => $this->customer, - 'total' => $this->total(), - 'currency' => $this->currency, - 'created_at_formatted' => format_date($this->date(), '%d. %B. %Y'), - 'created_at' => $this->created, - 'order' => $this->number, - 'user_id' => $user->id ?? null, - 'client' => [ - 'billing_address' => $this->customer_address, - 'billing_name' => $this->customer_name, + 'customer' => $this->customer, + 'total' => $this->total(), + 'currency' => $this->currency, + 'created_at_formatted' => format_date($this->date(), '%d. %B. %Y'), + 'created_at' => $this->created, + 'order' => $this->number, + 'user_id' => $user->id ?? null, + 'client' => [ + 'billing_address' => $this->customer_address, + 'billing_name' => $this->customer_name, 'billing_phone_number' => $this->customer_phone, ], - 'seller' => null, - 'invoice_items' => $this->get_invoice_items(), + 'seller' => null, + 'invoice_items' => $this->get_invoice_items(), 'invoice_subscriptions' => $this->get_invoice_subscriptions(), ], $this->mergeWhen($user, [ 'relationships' => [ 'user' => [ 'data' => [ - 'id' => $user->id, - 'type' => 'user', + 'id' => $user->id, + 'type' => 'user', 'attributes' => [ - 'name' => $user->settings->name, + 'name' => $user->settings->name, 'avatar' => $user->settings->avatar, - ] - ] - ] - ] + ], + ], + ], + ], ]), ], ]; @@ -66,10 +65,10 @@ class InvoiceResource extends JsonResource foreach ($this->subscriptions() as $item) { array_push($array, [ - 'amount' => $item->total(), + 'amount' => $item->total(), 'description' => $item->description, - 'currency' => $item->currency, - 'type' => $item->type, + 'currency' => $item->currency, + 'type' => $item->type, ]); } @@ -85,10 +84,10 @@ class InvoiceResource extends JsonResource foreach ($this->invoiceItems() as $item) { array_push($array, [ - 'amount' => $item->total(), + 'amount' => $item->total(), 'description' => $item->description, - 'currency' => $item->currency, - 'type' => $item->type, + 'currency' => $item->currency, + 'type' => $item->type, ]); } diff --git a/app/Http/Resources/LanguageCollection.php b/app/Http/Resources/LanguageCollection.php index 0bfde44f..b1f786e0 100644 --- a/app/Http/Resources/LanguageCollection.php +++ b/app/Http/Resources/LanguageCollection.php @@ -1,5 +1,4 @@ $this->collection, 'meta' => [ - 'current_language' => new LanguageResource($current_language), - 'reference_translations' => get_default_language_translations() + 'current_language' => new LanguageResource($current_language), + 'reference_translations' => get_default_language_translations(), ], ]; } diff --git a/app/Http/Resources/LanguageResource.php b/app/Http/Resources/LanguageResource.php index 0d2f5a08..162ed330 100644 --- a/app/Http/Resources/LanguageResource.php +++ b/app/Http/Resources/LanguageResource.php @@ -1,5 +1,4 @@ [ - 'id' => $this->id, - 'type' => 'languages', + 'id' => $this->id, + 'type' => 'languages', 'attributes' => [ - 'name' => $this->name, - 'locale' => $this->locale, + 'name' => $this->name, + 'locale' => $this->locale, 'translations' => map_language_translations($this->languageTranslations), - 'updated_at' => $this->updated_at, - 'created_at' => $this->created_at, - ] + 'updated_at' => $this->updated_at, + 'created_at' => $this->created_at, + ], ], ]; } diff --git a/app/Http/Resources/PageCollection.php b/app/Http/Resources/PageCollection.php index 9d693b0f..8e583cf5 100644 --- a/app/Http/Resources/PageCollection.php +++ b/app/Http/Resources/PageCollection.php @@ -1,5 +1,4 @@ [ - 'id' => $this->slug, - 'type' => 'pages', + 'id' => $this->slug, + 'type' => 'pages', 'attributes' => [ - 'visibility' => $this->visibility, - 'title' => $this->title, - 'slug' => $this->slug, - 'content' => $this->content, + 'visibility' => $this->visibility, + 'title' => $this->title, + 'slug' => $this->slug, + 'content' => $this->content, 'content_formatted' => add_paragraphs($this->content), - ] + ], ], ]; } diff --git a/app/Http/Resources/PaymentCardCollection.php b/app/Http/Resources/PaymentCardCollection.php index 96cb6cc8..88c4a741 100644 --- a/app/Http/Resources/PaymentCardCollection.php +++ b/app/Http/Resources/PaymentCardCollection.php @@ -1,5 +1,4 @@ [ - 'id' => (string)$this['id'], - 'type' => 'payment_method', + 'id' => (string) $this['id'], + 'type' => 'payment_method', 'attributes' => [ - 'provider' => 'stripe', - 'card_id' => $this['id'], - 'brand' => strtolower($this['card']['brand']), - 'last4' => $this['card']['last4'], - 'exp_month' => $this['card']['exp_month'], - 'exp_year' => $this['card']['exp_year'], + 'provider' => 'stripe', + 'card_id' => $this['id'], + 'brand' => strtolower($this['card']['brand']), + 'last4' => $this['card']['last4'], + 'exp_month' => $this['card']['exp_month'], + 'exp_year' => $this['card']['exp_year'], 'created_at' => format_date($this['created_at'], '%d. %B. %Y'), - 'status' => 'active', - 'default' => 0, - ] - ] + 'status' => 'active', + 'default' => 0, + ], + ], ]; } } diff --git a/app/Http/Resources/PaymentDefaultCardResource.php b/app/Http/Resources/PaymentDefaultCardResource.php index 3c102cbc..e64b5a1b 100644 --- a/app/Http/Resources/PaymentDefaultCardResource.php +++ b/app/Http/Resources/PaymentDefaultCardResource.php @@ -1,5 +1,4 @@ [ - 'id' => (string)$this['id'], - 'type' => 'payment_method', + 'id' => (string) $this['id'], + 'type' => 'payment_method', 'attributes' => [ - 'provider' => 'stripe', - 'card_id' => $this['id'], - 'brand' => isset($this['brand']) ? strtolower($this['brand']) : strtolower($this['card']['brand']), - 'last4' => isset($this['last4']) ? $this['last4'] : $this['card']['last4'], - 'exp_month' => isset($this['exp_month']) ? $this['exp_month'] : $this['card']['exp_month'], - 'exp_year' => isset($this['exp_year']) ? $this['exp_year'] : $this['card']['exp_year'], + 'provider' => 'stripe', + 'card_id' => $this['id'], + 'brand' => isset($this['brand']) ? strtolower($this['brand']) : strtolower($this['card']['brand']), + 'last4' => isset($this['last4']) ? $this['last4'] : $this['card']['last4'], + 'exp_month' => isset($this['exp_month']) ? $this['exp_month'] : $this['card']['exp_month'], + 'exp_year' => isset($this['exp_year']) ? $this['exp_year'] : $this['card']['exp_year'], 'created_at' => format_date($this['created_at'], '%d. %B. %Y'), - 'status' => 'active', - 'default' => 0, - ] - ] + 'status' => 'active', + 'default' => 0, + ], + ], ]; } } diff --git a/app/Http/Resources/PlanCollection.php b/app/Http/Resources/PlanCollection.php index 322ca842..82a9378a 100644 --- a/app/Http/Resources/PlanCollection.php +++ b/app/Http/Resources/PlanCollection.php @@ -1,5 +1,4 @@ [ - 'id' => $this['plan']['id'], - 'type' => 'plans', + 'id' => $this['plan']['id'], + 'type' => 'plans', 'attributes' => [ - 'subscribers' => $subscriber_count->count(), - 'status' => $this['plan']['active'] ? 1 : 0, - 'name' => $this['product']['name'], - 'description' => $this['product']['description'], - 'price' => $this['plan']['amount'], - 'price_formatted' => Cashier::formatAmount($this['plan']['amount']), - 'capacity_formatted' => format_gigabytes($this['product']['metadata']['capacity']), - 'capacity' => (int) $this['product']['metadata']['capacity'], + 'subscribers' => $subscriber_count->count(), + 'status' => $this['plan']['active'] ? 1 : 0, + 'name' => $this['product']['name'], + 'description' => $this['product']['description'], + 'price' => $this['plan']['amount'], + 'price_formatted' => Cashier::formatAmount($this['plan']['amount']), + 'capacity_formatted' => format_gigabytes($this['product']['metadata']['capacity']), + 'capacity' => (int) $this['product']['metadata']['capacity'], 'created_at_formatted' => format_date($this['plan']['created']), - 'created_at' => $this['plan']['created'], - ] - ] + 'created_at' => $this['plan']['created'], + ], + ], ]; } } diff --git a/app/Http/Resources/PricingCollection.php b/app/Http/Resources/PricingCollection.php index 41f9c862..4f019c2c 100644 --- a/app/Http/Resources/PricingCollection.php +++ b/app/Http/Resources/PricingCollection.php @@ -1,5 +1,4 @@ [ - 'id' => $this['plan']['id'], - 'type' => 'plans', + 'id' => $this['plan']['id'], + 'type' => 'plans', 'attributes' => [ - 'name' => $this['product']['name'], - 'description' => $this['product']['description'], - 'price' => Cashier::formatAmount($this['plan']['amount']), + 'name' => $this['product']['name'], + 'description' => $this['product']['description'], + 'price' => Cashier::formatAmount($this['plan']['amount']), 'capacity_formatted' => format_gigabytes($this['product']['metadata']['capacity']), - 'capacity' => (int)$this['product']['metadata']['capacity'], - 'currency' => config('cashier.currency'), - 'tax_rates' => resolve(StripeService::class)->get_tax_rates($this['plan']['amount']) - ] - ] + 'capacity' => (int) $this['product']['metadata']['capacity'], + 'currency' => config('cashier.currency'), + 'tax_rates' => resolve(StripeService::class)->get_tax_rates($this['plan']['amount']), + ], + ], ]; } -} \ No newline at end of file +} diff --git a/app/Http/Resources/ShareResource.php b/app/Http/Resources/ShareResource.php index fdd89e37..082568e8 100644 --- a/app/Http/Resources/ShareResource.php +++ b/app/Http/Resources/ShareResource.php @@ -1,5 +1,4 @@ [ - 'id' => (string)$this->id, - 'type' => 'shares', + 'id' => (string) $this->id, + 'type' => 'shares', 'attributes' => [ - 'permission' => $this->permission, + 'permission' => $this->permission, 'is_protected' => $this->is_protected, - 'item_id' => $this->item_id, - 'expire_in' => (int)$this->expire_in, - 'token' => $this->token, - 'link' => $this->link, - 'type' => $this->type, - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, - ] - ] + 'item_id' => $this->item_id, + 'expire_in' => (int) $this->expire_in, + 'token' => $this->token, + 'link' => $this->link, + 'type' => $this->type, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + ], + ], ]; } } diff --git a/app/Http/Resources/UserResource.php b/app/Http/Resources/UserResource.php index 910d916b..c4ba3f05 100644 --- a/app/Http/Resources/UserResource.php +++ b/app/Http/Resources/UserResource.php @@ -1,11 +1,6 @@ [ - 'id' => $this->id, - 'type' => 'user', - 'attributes' => [ - 'storage_capacity' => $this->settings->storage_capacity, - 'subscription' => $this->subscribed('main'), - 'incomplete_payment' => $this->hasIncompletePayment('main') ? route('cashier.payment', $this->subscription('main')->latestPayment()->id) : null, - 'stripe_customer' => is_null($this->stripe_id) ? false : true, - 'email' => is_demo() ? obfuscate_email($this->email) : $this->email, - 'role' => $this->role, - 'folders' => $this->folder_tree, - 'storage' => $this->storage, + 'id' => $this->id, + 'type' => 'user', + 'attributes' => [ + 'storage_capacity' => $this->settings->storage_capacity, + 'subscription' => $this->subscribed('main'), + 'incomplete_payment' => $this->hasIncompletePayment('main') ? route('cashier.payment', $this->subscription('main')->latestPayment()->id) : null, + 'stripe_customer' => is_null($this->stripe_id) ? false : true, + 'email' => is_demo() ? obfuscate_email($this->email) : $this->email, + 'role' => $this->role, + 'folders' => $this->folder_tree, + 'storage' => $this->storage, 'created_at_formatted' => format_date($this->created_at, '%d. %B. %Y'), - 'created_at' => $this->created_at, - 'updated_at' => $this->updated_at, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, ], 'relationships' => [ - 'settings' => [ + 'settings' => [ 'data' => [ - 'id' => $this->id, - 'type' => 'settings', + 'id' => $this->id, + 'type' => 'settings', 'attributes' => [ - 'avatar' => $this->settings->avatar, - 'name' => $this->settings->name, - 'address' => $this->settings->address, - 'state' => $this->settings->state, - 'city' => $this->settings->city, - 'postal_code' => $this->settings->postal_code, - 'country' => $this->settings->country, + 'avatar' => $this->settings->avatar, + 'name' => $this->settings->name, + 'address' => $this->settings->address, + 'state' => $this->settings->state, + 'city' => $this->settings->city, + 'postal_code' => $this->settings->postal_code, + 'country' => $this->settings->country, 'phone_number' => $this->settings->phone_number, - 'timezone' => $this->settings->timezone - ] - ] + 'timezone' => $this->settings->timezone, + ], + ], ], 'favourites' => [ 'data' => [ - 'id' => $this->id, - 'type' => 'favourite_folders', + 'id' => $this->id, + 'type' => 'favourite_folders', 'attributes' => [ - 'folders' => $this->favouriteFolders->makeHidden(['pivot']) + 'folders' => $this->favouriteFolders->makeHidden(['pivot']), ], ], - ] - ] + ], + ], ], ]; } diff --git a/app/Http/Resources/UserStorageResource.php b/app/Http/Resources/UserStorageResource.php index a8897baf..32627880 100644 --- a/app/Http/Resources/UserStorageResource.php +++ b/app/Http/Resources/UserStorageResource.php @@ -1,5 +1,4 @@ id) ->where('type', 'image')->get()->map(function ($item) { - return (int)$item->getRawOriginal('filesize'); + return (int) $item->getRawOriginal('filesize'); })->sum(); // Get all audios $audios = File::where('user_id', $this->id) ->where('type', 'audio')->get()->map(function ($item) { - return (int)$item->getRawOriginal('filesize'); + return (int) $item->getRawOriginal('filesize'); })->sum(); // Get all videos $videos = File::where('user_id', $this->id) ->where('type', 'video')->get()->map(function ($item) { - return (int)$item->getRawOriginal('filesize'); + return (int) $item->getRawOriginal('filesize'); })->sum(); // Get all documents $documents = File::where('user_id', $this->id) ->whereIn('mimetype', $document_mimetypes)->get()->map(function ($item) { - return (int)$item->getRawOriginal('filesize'); + return (int) $item->getRawOriginal('filesize'); })->sum(); // Get all other files @@ -49,41 +48,41 @@ class UserStorageResource extends JsonResource ->whereNotIn('mimetype', $document_mimetypes) ->whereNotIn('type', ['audio', 'video', 'image']) ->get()->map(function ($item) { - return (int)$item->getRawOriginal('filesize'); + return (int) $item->getRawOriginal('filesize'); })->sum(); return [ 'data' => [ - 'id' => (string)$this->id, - 'type' => 'storage', - 'attributes' => [ - 'used' => Metric::bytes($this->used_capacity)->format(), - 'capacity' => format_gigabytes($this->settings->storage_capacity), - 'percentage' => (float)get_storage_fill_percentage($this->used_capacity, $this->settings->storage_capacity), + 'id' => (string) $this->id, + 'type' => 'storage', + 'attributes' => [ + 'used' => Metric::bytes($this->used_capacity)->format(), + 'capacity' => format_gigabytes($this->settings->storage_capacity), + 'percentage' => (float) get_storage_fill_percentage($this->used_capacity, $this->settings->storage_capacity), ], 'meta' => [ - 'images' => [ - 'used' => Metric::bytes($images)->format(), - 'percentage' => (float)get_storage_fill_percentage($images, $this->settings->storage_capacity), + 'images' => [ + 'used' => Metric::bytes($images)->format(), + 'percentage' => (float) get_storage_fill_percentage($images, $this->settings->storage_capacity), ], - 'audios' => [ - 'used' => Metric::bytes($audios)->format(), - 'percentage' => (float)get_storage_fill_percentage($audios, $this->settings->storage_capacity), + 'audios' => [ + 'used' => Metric::bytes($audios)->format(), + 'percentage' => (float) get_storage_fill_percentage($audios, $this->settings->storage_capacity), ], - 'videos' => [ - 'used' => Metric::bytes($videos)->format(), - 'percentage' => (float)get_storage_fill_percentage($videos, $this->settings->storage_capacity), + 'videos' => [ + 'used' => Metric::bytes($videos)->format(), + 'percentage' => (float) get_storage_fill_percentage($videos, $this->settings->storage_capacity), ], 'documents' => [ - 'used' => Metric::bytes($documents)->format(), - 'percentage' => (float)get_storage_fill_percentage($documents, $this->settings->storage_capacity), + 'used' => Metric::bytes($documents)->format(), + 'percentage' => (float) get_storage_fill_percentage($documents, $this->settings->storage_capacity), ], - 'others' => [ - 'used' => Metric::bytes($others)->format(), - 'percentage' => (float)get_storage_fill_percentage($others, $this->settings->storage_capacity), + 'others' => [ + 'used' => Metric::bytes($others)->format(), + 'percentage' => (float) get_storage_fill_percentage($others, $this->settings->storage_capacity), ], - ] - ] + ], + ], ]; } } diff --git a/app/Http/Resources/UserSubscription.php b/app/Http/Resources/UserSubscription.php index 73e505e4..4ca3b111 100644 --- a/app/Http/Resources/UserSubscription.php +++ b/app/Http/Resources/UserSubscription.php @@ -1,5 +1,4 @@ [ - 'id' => $subscription['plan']['id'], - 'type' => 'subscription', + 'id' => $subscription['plan']['id'], + 'type' => 'subscription', 'attributes' => [ - 'incomplete' => $this->subscription('main')->incomplete(), - 'active' => $this->subscription('main')->active(), - 'canceled' => $this->subscription('main')->cancelled(), - 'name' => $subscription['product']['name'], - 'capacity' => (int)$subscription['product']['metadata']['capacity'], + 'incomplete' => $this->subscription('main')->incomplete(), + 'active' => $this->subscription('main')->active(), + 'canceled' => $this->subscription('main')->cancelled(), + 'name' => $subscription['product']['name'], + 'capacity' => (int) $subscription['product']['metadata']['capacity'], 'capacity_formatted' => format_gigabytes($subscription['product']['metadata']['capacity']), - 'slug' => $subscription['plan']['id'], - 'canceled_at' => format_date($active_subscription["canceled_at"], '%d. %B. %Y'), - 'created_at' => format_date($active_subscription["current_period_start"], '%d. %B. %Y'), - 'ends_at' => format_date($active_subscription["current_period_end"], '%d. %B. %Y'), - ] - ] + 'slug' => $subscription['plan']['id'], + 'canceled_at' => format_date($active_subscription['canceled_at'], '%d. %B. %Y'), + 'created_at' => format_date($active_subscription['current_period_start'], '%d. %B. %Y'), + 'ends_at' => format_date($active_subscription['current_period_end'], '%d. %B. %Y'), + ], + ], ]; } } diff --git a/app/Http/Resources/UsersCollection.php b/app/Http/Resources/UsersCollection.php index 2aa56cf4..ac48d5a3 100644 --- a/app/Http/Resources/UsersCollection.php +++ b/app/Http/Resources/UsersCollection.php @@ -1,5 +1,4 @@ \n\n
", $str); // The following regexes only need to be executed if the string contains html - if ($html_found !== FALSE) { + if ($html_found !== false) { // Remove p tags around $no_p elements $str = preg_replace('~
(?=?' . $no_p . '[^>]*+>)~i', '', $str); $str = preg_replace('~(?' . $no_p . '[^>]*+>)
~i', '$1', $str); @@ -125,7 +126,6 @@ function setEnvironmentValue(array $values) if (count($values) > 0) { foreach ($values as $envKey => $envValue) { - $str .= "\n"; // In case the searched variable is in the last line without \n $keyPosition = strpos($str, "{$envKey}="); $endOfLinePosition = strpos($str, "\n", $keyPosition); @@ -137,9 +137,9 @@ function setEnvironmentValue(array $values) } $str = substr($str, 0, -1); - if (!file_put_contents($envFile, $str)) return false; - return true; + return ! (! file_put_contents($envFile, $str)) + ; } /** @@ -153,9 +153,9 @@ function get_invoice_number() if ($invoices->isEmpty()) { return now()->year . '001'; - } else { - return (int)$invoices->last()->order + 1; } + + return (int) $invoices->last()->order + 1; } /** @@ -206,7 +206,7 @@ function get_version() /** * Check if is demo * - * @return boolean + * @return bool */ function is_demo() { @@ -281,7 +281,7 @@ function is_visitor($shared) */ function store_avatar($request, $name) { - if (!$request->hasFile($name)) { + if (! $request->hasFile($name)) { return null; } @@ -312,7 +312,7 @@ function store_avatar($request, $name) */ function store_system_image($request, $name) { - if (!$request->hasFile($name)) { + if (! $request->hasFile($name)) { return null; } @@ -356,9 +356,9 @@ function format_gigabytes($gigabytes) { if ($gigabytes >= 1000) { return Metric::gigabytes($gigabytes)->format('Tb/'); - } else { - return Metric::gigabytes($gigabytes)->format('GB/'); } + + return Metric::gigabytes($gigabytes)->format('GB/'); } /** @@ -411,7 +411,7 @@ function get_storage_fill_percentage($used, $capacity) } // Return in 2 decimal - return number_format((float)$progress, 2, '.', ''); + return number_format((float) $progress, 2, '.', ''); } /** @@ -445,12 +445,14 @@ function recursiveFind(array $array, $needle) { $iterator = new RecursiveArrayIterator($array); $recursive = new RecursiveIteratorIterator($iterator, RecursiveIteratorIterator::SELF_FIRST); - $aHitList = array(); + $aHitList = []; + foreach ($recursive as $key => $value) { if ($key === $needle) { array_push($aHitList, $value); } } + return $aHitList; } @@ -466,7 +468,6 @@ function appeared_once($arr) $single_time_comming_values_array = []; foreach ($array_count_values as $key => $val) { - if ($val == 1) { $single_time_comming_values_array[] = $key; } @@ -515,13 +516,19 @@ function get_file_type($file_mimetype) switch ($mimetype[0]) { case 'image': return 'image'; + break; + case 'video': return 'video'; + break; + case 'audio': return 'audio'; + break; + default: return 'file'; } @@ -583,16 +590,11 @@ function get_pretty_name($basename, $name, $mimetype) function get_image_meta_data($file) { if (get_file_type_from_mimetype($file->getMimeType()) === 'jpeg') { - try { - // Try to get the exif data return mb_convert_encoding(Image::make($file->getRealPath())->exif(), 'UTF8', 'UTF8'); - } catch (\Exception $e) { - return null; - } } } @@ -603,9 +605,9 @@ function get_image_meta_data($file) function get_default_language_translations() { return collect([ - config("language-translations.extended"), - config("language-translations.regular"), - config("custom-language-translations") + config('language-translations.extended'), + config('language-translations.regular'), + config('custom-language-translations'), ])->collapse(); } @@ -626,20 +628,39 @@ function is_dev() function seems_utf8($str) { $length = strlen($str); + for ($i = 0; $i < $length; $i++) { $c = ord($str[$i]); - if ($c < 0x80) $n = 0; # 0bbbbbbb - elseif (($c & 0xE0) == 0xC0) $n = 1; # 110bbbbb - elseif (($c & 0xF0) == 0xE0) $n = 2; # 1110bbbb - elseif (($c & 0xF8) == 0xF0) $n = 3; # 11110bbb - elseif (($c & 0xFC) == 0xF8) $n = 4; # 111110bb - elseif (($c & 0xFE) == 0xFC) $n = 5; # 1111110b - else return false; # Does not match any model + + if ($c < 0x80) { + $n = 0; + } # 0bbbbbbb + elseif (($c & 0xE0) == 0xC0) { + $n = 1; + } # 110bbbbb + elseif (($c & 0xF0) == 0xE0) { + $n = 2; + } # 1110bbbb + elseif (($c & 0xF8) == 0xF0) { + $n = 3; + } # 11110bbb + elseif (($c & 0xFC) == 0xF8) { + $n = 4; + } # 111110bb + elseif (($c & 0xFE) == 0xFC) { + $n = 5; + } # 1111110b + else { + return false; + } # Does not match any model + for ($j = 0; $j < $n; $j++) { # n bytes matching 10bbbbbb follow ? - if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80)) + if ((++$i == $length) || ((ord($str[$i]) & 0xC0) != 0x80)) { return false; + } } } + return true; } @@ -653,109 +674,110 @@ function seems_utf8($str) */ function remove_accents($string) { - if (!preg_match('/[\x80-\xff]/', $string)) + if (! preg_match('/[\x80-\xff]/', $string)) { return $string; + } if (seems_utf8($string)) { - $chars = array( + $chars = [ // Decompositions for Latin-1 Supplement - chr(195) . chr(128) => 'A', chr(195) . chr(129) => 'A', - chr(195) . chr(130) => 'A', chr(195) . chr(131) => 'A', - chr(195) . chr(132) => 'A', chr(195) . chr(133) => 'A', - chr(195) . chr(135) => 'C', chr(195) . chr(136) => 'E', - chr(195) . chr(137) => 'E', chr(195) . chr(138) => 'E', - chr(195) . chr(139) => 'E', chr(195) . chr(140) => 'I', - chr(195) . chr(141) => 'I', chr(195) . chr(142) => 'I', - chr(195) . chr(143) => 'I', chr(195) . chr(145) => 'N', - chr(195) . chr(146) => 'O', chr(195) . chr(147) => 'O', - chr(195) . chr(148) => 'O', chr(195) . chr(149) => 'O', - chr(195) . chr(150) => 'O', chr(195) . chr(153) => 'U', - chr(195) . chr(154) => 'U', chr(195) . chr(155) => 'U', - chr(195) . chr(156) => 'U', chr(195) . chr(157) => 'Y', - chr(195) . chr(159) => 's', chr(195) . chr(160) => 'a', - chr(195) . chr(161) => 'a', chr(195) . chr(162) => 'a', - chr(195) . chr(163) => 'a', chr(195) . chr(164) => 'a', - chr(195) . chr(165) => 'a', chr(195) . chr(167) => 'c', - chr(195) . chr(168) => 'e', chr(195) . chr(169) => 'e', - chr(195) . chr(170) => 'e', chr(195) . chr(171) => 'e', - chr(195) . chr(172) => 'i', chr(195) . chr(173) => 'i', - chr(195) . chr(174) => 'i', chr(195) . chr(175) => 'i', - chr(195) . chr(177) => 'n', chr(195) . chr(178) => 'o', - chr(195) . chr(179) => 'o', chr(195) . chr(180) => 'o', - chr(195) . chr(181) => 'o', chr(195) . chr(182) => 'o', - chr(195) . chr(182) => 'o', chr(195) . chr(185) => 'u', - chr(195) . chr(186) => 'u', chr(195) . chr(187) => 'u', - chr(195) . chr(188) => 'u', chr(195) . chr(189) => 'y', - chr(195) . chr(191) => 'y', + chr(195) . chr(128) => 'A', chr(195) . chr(129) => 'A', + chr(195) . chr(130) => 'A', chr(195) . chr(131) => 'A', + chr(195) . chr(132) => 'A', chr(195) . chr(133) => 'A', + chr(195) . chr(135) => 'C', chr(195) . chr(136) => 'E', + chr(195) . chr(137) => 'E', chr(195) . chr(138) => 'E', + chr(195) . chr(139) => 'E', chr(195) . chr(140) => 'I', + chr(195) . chr(141) => 'I', chr(195) . chr(142) => 'I', + chr(195) . chr(143) => 'I', chr(195) . chr(145) => 'N', + chr(195) . chr(146) => 'O', chr(195) . chr(147) => 'O', + chr(195) . chr(148) => 'O', chr(195) . chr(149) => 'O', + chr(195) . chr(150) => 'O', chr(195) . chr(153) => 'U', + chr(195) . chr(154) => 'U', chr(195) . chr(155) => 'U', + chr(195) . chr(156) => 'U', chr(195) . chr(157) => 'Y', + chr(195) . chr(159) => 's', chr(195) . chr(160) => 'a', + chr(195) . chr(161) => 'a', chr(195) . chr(162) => 'a', + chr(195) . chr(163) => 'a', chr(195) . chr(164) => 'a', + chr(195) . chr(165) => 'a', chr(195) . chr(167) => 'c', + chr(195) . chr(168) => 'e', chr(195) . chr(169) => 'e', + chr(195) . chr(170) => 'e', chr(195) . chr(171) => 'e', + chr(195) . chr(172) => 'i', chr(195) . chr(173) => 'i', + chr(195) . chr(174) => 'i', chr(195) . chr(175) => 'i', + chr(195) . chr(177) => 'n', chr(195) . chr(178) => 'o', + chr(195) . chr(179) => 'o', chr(195) . chr(180) => 'o', + chr(195) . chr(181) => 'o', chr(195) . chr(182) => 'o', + chr(195) . chr(182) => 'o', chr(195) . chr(185) => 'u', + chr(195) . chr(186) => 'u', chr(195) . chr(187) => 'u', + chr(195) . chr(188) => 'u', chr(195) . chr(189) => 'y', + chr(195) . chr(191) => 'y', // Decompositions for Latin Extended-A - chr(196) . chr(128) => 'A', chr(196) . chr(129) => 'a', - chr(196) . chr(130) => 'A', chr(196) . chr(131) => 'a', - chr(196) . chr(132) => 'A', chr(196) . chr(133) => 'a', - chr(196) . chr(134) => 'C', chr(196) . chr(135) => 'c', - chr(196) . chr(136) => 'C', chr(196) . chr(137) => 'c', - chr(196) . chr(138) => 'C', chr(196) . chr(139) => 'c', - chr(196) . chr(140) => 'C', chr(196) . chr(141) => 'c', - chr(196) . chr(142) => 'D', chr(196) . chr(143) => 'd', - chr(196) . chr(144) => 'D', chr(196) . chr(145) => 'd', - chr(196) . chr(146) => 'E', chr(196) . chr(147) => 'e', - chr(196) . chr(148) => 'E', chr(196) . chr(149) => 'e', - chr(196) . chr(150) => 'E', chr(196) . chr(151) => 'e', - chr(196) . chr(152) => 'E', chr(196) . chr(153) => 'e', - chr(196) . chr(154) => 'E', chr(196) . chr(155) => 'e', - chr(196) . chr(156) => 'G', chr(196) . chr(157) => 'g', - chr(196) . chr(158) => 'G', chr(196) . chr(159) => 'g', - chr(196) . chr(160) => 'G', chr(196) . chr(161) => 'g', - chr(196) . chr(162) => 'G', chr(196) . chr(163) => 'g', - chr(196) . chr(164) => 'H', chr(196) . chr(165) => 'h', - chr(196) . chr(166) => 'H', chr(196) . chr(167) => 'h', - chr(196) . chr(168) => 'I', chr(196) . chr(169) => 'i', - chr(196) . chr(170) => 'I', chr(196) . chr(171) => 'i', - chr(196) . chr(172) => 'I', chr(196) . chr(173) => 'i', - chr(196) . chr(174) => 'I', chr(196) . chr(175) => 'i', - chr(196) . chr(176) => 'I', chr(196) . chr(177) => 'i', - chr(196) . chr(178) => 'IJ', chr(196) . chr(179) => 'ij', - chr(196) . chr(180) => 'J', chr(196) . chr(181) => 'j', - chr(196) . chr(182) => 'K', chr(196) . chr(183) => 'k', - chr(196) . chr(184) => 'k', chr(196) . chr(185) => 'L', - chr(196) . chr(186) => 'l', chr(196) . chr(187) => 'L', - chr(196) . chr(188) => 'l', chr(196) . chr(189) => 'L', - chr(196) . chr(190) => 'l', chr(196) . chr(191) => 'L', - chr(197) . chr(128) => 'l', chr(197) . chr(129) => 'L', - chr(197) . chr(130) => 'l', chr(197) . chr(131) => 'N', - chr(197) . chr(132) => 'n', chr(197) . chr(133) => 'N', - chr(197) . chr(134) => 'n', chr(197) . chr(135) => 'N', - chr(197) . chr(136) => 'n', chr(197) . chr(137) => 'N', - chr(197) . chr(138) => 'n', chr(197) . chr(139) => 'N', - chr(197) . chr(140) => 'O', chr(197) . chr(141) => 'o', - chr(197) . chr(142) => 'O', chr(197) . chr(143) => 'o', - chr(197) . chr(144) => 'O', chr(197) . chr(145) => 'o', - chr(197) . chr(146) => 'OE', chr(197) . chr(147) => 'oe', - chr(197) . chr(148) => 'R', chr(197) . chr(149) => 'r', - chr(197) . chr(150) => 'R', chr(197) . chr(151) => 'r', - chr(197) . chr(152) => 'R', chr(197) . chr(153) => 'r', - chr(197) . chr(154) => 'S', chr(197) . chr(155) => 's', - chr(197) . chr(156) => 'S', chr(197) . chr(157) => 's', - chr(197) . chr(158) => 'S', chr(197) . chr(159) => 's', - chr(197) . chr(160) => 'S', chr(197) . chr(161) => 's', - chr(197) . chr(162) => 'T', chr(197) . chr(163) => 't', - chr(197) . chr(164) => 'T', chr(197) . chr(165) => 't', - chr(197) . chr(166) => 'T', chr(197) . chr(167) => 't', - chr(197) . chr(168) => 'U', chr(197) . chr(169) => 'u', - chr(197) . chr(170) => 'U', chr(197) . chr(171) => 'u', - chr(197) . chr(172) => 'U', chr(197) . chr(173) => 'u', - chr(197) . chr(174) => 'U', chr(197) . chr(175) => 'u', - chr(197) . chr(176) => 'U', chr(197) . chr(177) => 'u', - chr(197) . chr(178) => 'U', chr(197) . chr(179) => 'u', - chr(197) . chr(180) => 'W', chr(197) . chr(181) => 'w', - chr(197) . chr(182) => 'Y', chr(197) . chr(183) => 'y', - chr(197) . chr(184) => 'Y', chr(197) . chr(185) => 'Z', - chr(197) . chr(186) => 'z', chr(197) . chr(187) => 'Z', - chr(197) . chr(188) => 'z', chr(197) . chr(189) => 'Z', - chr(197) . chr(190) => 'z', chr(197) . chr(191) => 's', + chr(196) . chr(128) => 'A', chr(196) . chr(129) => 'a', + chr(196) . chr(130) => 'A', chr(196) . chr(131) => 'a', + chr(196) . chr(132) => 'A', chr(196) . chr(133) => 'a', + chr(196) . chr(134) => 'C', chr(196) . chr(135) => 'c', + chr(196) . chr(136) => 'C', chr(196) . chr(137) => 'c', + chr(196) . chr(138) => 'C', chr(196) . chr(139) => 'c', + chr(196) . chr(140) => 'C', chr(196) . chr(141) => 'c', + chr(196) . chr(142) => 'D', chr(196) . chr(143) => 'd', + chr(196) . chr(144) => 'D', chr(196) . chr(145) => 'd', + chr(196) . chr(146) => 'E', chr(196) . chr(147) => 'e', + chr(196) . chr(148) => 'E', chr(196) . chr(149) => 'e', + chr(196) . chr(150) => 'E', chr(196) . chr(151) => 'e', + chr(196) . chr(152) => 'E', chr(196) . chr(153) => 'e', + chr(196) . chr(154) => 'E', chr(196) . chr(155) => 'e', + chr(196) . chr(156) => 'G', chr(196) . chr(157) => 'g', + chr(196) . chr(158) => 'G', chr(196) . chr(159) => 'g', + chr(196) . chr(160) => 'G', chr(196) . chr(161) => 'g', + chr(196) . chr(162) => 'G', chr(196) . chr(163) => 'g', + chr(196) . chr(164) => 'H', chr(196) . chr(165) => 'h', + chr(196) . chr(166) => 'H', chr(196) . chr(167) => 'h', + chr(196) . chr(168) => 'I', chr(196) . chr(169) => 'i', + chr(196) . chr(170) => 'I', chr(196) . chr(171) => 'i', + chr(196) . chr(172) => 'I', chr(196) . chr(173) => 'i', + chr(196) . chr(174) => 'I', chr(196) . chr(175) => 'i', + chr(196) . chr(176) => 'I', chr(196) . chr(177) => 'i', + chr(196) . chr(178) => 'IJ', chr(196) . chr(179) => 'ij', + chr(196) . chr(180) => 'J', chr(196) . chr(181) => 'j', + chr(196) . chr(182) => 'K', chr(196) . chr(183) => 'k', + chr(196) . chr(184) => 'k', chr(196) . chr(185) => 'L', + chr(196) . chr(186) => 'l', chr(196) . chr(187) => 'L', + chr(196) . chr(188) => 'l', chr(196) . chr(189) => 'L', + chr(196) . chr(190) => 'l', chr(196) . chr(191) => 'L', + chr(197) . chr(128) => 'l', chr(197) . chr(129) => 'L', + chr(197) . chr(130) => 'l', chr(197) . chr(131) => 'N', + chr(197) . chr(132) => 'n', chr(197) . chr(133) => 'N', + chr(197) . chr(134) => 'n', chr(197) . chr(135) => 'N', + chr(197) . chr(136) => 'n', chr(197) . chr(137) => 'N', + chr(197) . chr(138) => 'n', chr(197) . chr(139) => 'N', + chr(197) . chr(140) => 'O', chr(197) . chr(141) => 'o', + chr(197) . chr(142) => 'O', chr(197) . chr(143) => 'o', + chr(197) . chr(144) => 'O', chr(197) . chr(145) => 'o', + chr(197) . chr(146) => 'OE', chr(197) . chr(147) => 'oe', + chr(197) . chr(148) => 'R', chr(197) . chr(149) => 'r', + chr(197) . chr(150) => 'R', chr(197) . chr(151) => 'r', + chr(197) . chr(152) => 'R', chr(197) . chr(153) => 'r', + chr(197) . chr(154) => 'S', chr(197) . chr(155) => 's', + chr(197) . chr(156) => 'S', chr(197) . chr(157) => 's', + chr(197) . chr(158) => 'S', chr(197) . chr(159) => 's', + chr(197) . chr(160) => 'S', chr(197) . chr(161) => 's', + chr(197) . chr(162) => 'T', chr(197) . chr(163) => 't', + chr(197) . chr(164) => 'T', chr(197) . chr(165) => 't', + chr(197) . chr(166) => 'T', chr(197) . chr(167) => 't', + chr(197) . chr(168) => 'U', chr(197) . chr(169) => 'u', + chr(197) . chr(170) => 'U', chr(197) . chr(171) => 'u', + chr(197) . chr(172) => 'U', chr(197) . chr(173) => 'u', + chr(197) . chr(174) => 'U', chr(197) . chr(175) => 'u', + chr(197) . chr(176) => 'U', chr(197) . chr(177) => 'u', + chr(197) . chr(178) => 'U', chr(197) . chr(179) => 'u', + chr(197) . chr(180) => 'W', chr(197) . chr(181) => 'w', + chr(197) . chr(182) => 'Y', chr(197) . chr(183) => 'y', + chr(197) . chr(184) => 'Y', chr(197) . chr(185) => 'Z', + chr(197) . chr(186) => 'z', chr(197) . chr(187) => 'Z', + chr(197) . chr(188) => 'z', chr(197) . chr(189) => 'Z', + chr(197) . chr(190) => 'z', chr(197) . chr(191) => 's', // Euro Sign chr(226) . chr(130) . chr(172) => 'E', // GBP (Pound) Sign - chr(194) . chr(163) => ''); + chr(194) . chr(163) => '', ]; $string = strtr($string, $chars); } else { @@ -771,11 +793,11 @@ function remove_accents($string) . chr(244) . chr(245) . chr(246) . chr(248) . chr(249) . chr(250) . chr(251) . chr(252) . chr(253) . chr(255); - $chars['out'] = "EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy"; + $chars['out'] = 'EfSZszYcYuAAAAAACEEEEIIIINOOOOOOUUUUYaaaaaaceeeeiiiinoooooouuuuyy'; $string = strtr($string, $chars['in'], $chars['out']); - $double_chars['in'] = array(chr(140), chr(156), chr(198), chr(208), chr(222), chr(223), chr(230), chr(240), chr(254)); - $double_chars['out'] = array('OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th'); + $double_chars['in'] = [chr(140), chr(156), chr(198), chr(208), chr(222), chr(223), chr(230), chr(240), chr(254)]; + $double_chars['out'] = ['OE', 'oe', 'AE', 'DH', 'TH', 'ss', 'ae', 'dh', 'th']; $string = str_replace($double_chars['in'], $double_chars['out'], $string); } @@ -793,7 +815,7 @@ function remove_accents($string) function get_files_for_zip($folders, $files, $path = []) { // Return file list - if (!isset($folders->folders)) { + if (! isset($folders->folders)) { return $files->unique()->values()->all(); } @@ -803,9 +825,9 @@ function get_files_for_zip($folders, $files, $path = []) // Push file to collection $folders->files->each(function ($file) use ($files, $path) { $files->push([ - 'name' => $file->name, - 'basename' => $file->basename, - 'mimetype' => $file->mimetype, + 'name' => $file->name, + 'basename' => $file->basename, + 'mimetype' => $file->mimetype, 'folder_path' => implode('/', $path), ]); }); @@ -831,7 +853,6 @@ function set_time_by_user_timezone($time) $user = Auth::user(); if ($user) { - // Get the value of timezone if user have some $time_zone = intval($user->settings->timezone * 60 ?? null); @@ -891,12 +912,14 @@ function replace_occurrence($string, $values) { $occurrences = $values->map(function ($message, $key) { return [ - 'key' => ":$key", + 'key' => ":$key", 'message' => $message, ]; }); return str_ireplace( - $occurrences->pluck('key')->toArray(), $occurrences->pluck('message')->toArray(), $string + $occurrences->pluck('key')->toArray(), + $occurrences->pluck('message')->toArray(), + $string ); } diff --git a/app/Models/File.php b/app/Models/File.php index 64d8626b..4e1add6c 100644 --- a/app/Models/File.php +++ b/app/Models/File.php @@ -1,16 +1,15 @@ attributes['deleted_at']) return null; + if (! $this->attributes['deleted_at']) { + return null; + } return format_date(set_time_by_user_timezone($this->attributes['deleted_at']), __t('time')); } @@ -103,13 +104,11 @@ class File extends Model { // Get thumbnail from external storage if ($this->attributes['thumbnail'] && ! is_storage_driver(['local'])) { - return Storage::temporaryUrl("files/$this->user_id/{$this->attributes['thumbnail']}", now()->addHour()); } // Get thumbnail from local storage if ($this->attributes['thumbnail']) { - // Thumbnail route $route = route('thumbnail', ['name' => $this->attributes['thumbnail']]); @@ -132,16 +131,15 @@ class File extends Model { // Get file from external storage if (! is_storage_driver(['local'])) { - $file_pretty_name = is_storage_driver('backblaze') ? Str::snake(mb_strtolower($this->attributes['name'])) : get_pretty_name($this->attributes['basename'], $this->attributes['name'], $this->attributes['mimetype']); $header = [ - "ResponseAcceptRanges" => "bytes", - "ResponseContentType" => $this->attributes['mimetype'], - "ResponseContentLength" => $this->attributes['filesize'], - "ResponseContentRange" => "bytes 0-600/" . $this->attributes['filesize'], + 'ResponseAcceptRanges' => 'bytes', + 'ResponseContentType' => $this->attributes['mimetype'], + 'ResponseContentLength' => $this->attributes['filesize'], + 'ResponseContentRange' => 'bytes 0-600/' . $this->attributes['filesize'], 'ResponseContentDisposition' => 'attachment; filename=' . $file_pretty_name, ]; @@ -169,8 +167,8 @@ class File extends Model $name = Str::slug($array['name'], ' '); return [ - 'id' => $this->id, - 'name' => $name, + 'id' => $this->id, + 'name' => $name, 'nameNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$name]))), ]; } @@ -207,7 +205,7 @@ class File extends Model parent::boot(); static::creating(function ($file) { - $file->id = (string)Str::uuid(); + $file->id = (string) Str::uuid(); }); } } diff --git a/app/Models/Folder.php b/app/Models/Folder.php index a12314e9..b1875278 100644 --- a/app/Models/Folder.php +++ b/app/Models/Folder.php @@ -1,14 +1,13 @@ $this->id, - 'name' => $name, + 'id' => $this->id, + 'name' => $name, 'nameNgrams' => utf8_encode((new TNTIndexer)->buildTrigrams(implode(', ', [$name]))), ]; } @@ -114,7 +113,9 @@ class Folder extends Model */ public function getDeletedAtAttribute() { - if (!$this->attributes['deleted_at']) return null; + if (! $this->attributes['deleted_at']) { + return null; + } return format_date(set_time_by_user_timezone($this->attributes['deleted_at']), __t('time')); } @@ -151,7 +152,6 @@ class Folder extends Model */ public function trashed_files() { - return $this->hasMany(File::class, 'folder_id', 'id')->withTrashed(); } @@ -211,19 +211,15 @@ class Folder extends Model parent::boot(); static::creating(function ($model) { - $model->id = (string)Str::uuid(); + $model->id = (string) Str::uuid(); }); static::deleting(function ($item) { - if ($item->isForceDeleting()) { - $item->trashed_children()->each(function ($folder) { $folder->forceDelete(); }); - } else { - $item->children()->each(function ($folder) { $folder->delete(); }); @@ -235,7 +231,6 @@ class Folder extends Model }); static::restoring(function ($item) { - // Restore children folders $item->trashed_children()->each(function ($folder) { $folder->restore(); @@ -247,4 +242,4 @@ class Folder extends Model }); }); } -} \ No newline at end of file +} diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index f663d49d..6ffaa9fb 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -1,5 +1,4 @@ 'array', 'client' => 'array', - 'bag' => 'array', + 'bag' => 'array', ]; /** * @return \Illuminate\Database\Eloquent\Relations\HasOne */ - public function user() { + public function user() + { return $this->hasOne(User::class, 'id', 'user_id'); } } diff --git a/app/Models/Language.php b/app/Models/Language.php index daf50ef3..7e448bbe 100644 --- a/app/Models/Language.php +++ b/app/Models/Language.php @@ -1,12 +1,11 @@ create_default_language_translations( - get_setting('license') ?? 'extended', $language->locale + get_setting('license') ?? 'extended', + $language->locale ); }); diff --git a/app/Models/LanguageTranslation.php b/app/Models/LanguageTranslation.php index bb7b7a67..596f1e70 100644 --- a/app/Models/LanguageTranslation.php +++ b/app/Models/LanguageTranslation.php @@ -1,5 +1,4 @@ 'boolean' + 'is_protected' => 'boolean', ]; /** @@ -48,7 +47,7 @@ class Share extends Model parent::boot(); static::creating(function ($shared) { - $shared->id = (string)Str::uuid(); + $shared->id = (string) Str::uuid(); $shared->token = Str::random(16); }); } diff --git a/app/Models/Traffic.php b/app/Models/Traffic.php index f236446f..2c363a76 100644 --- a/app/Models/Traffic.php +++ b/app/Models/Traffic.php @@ -1,10 +1,9 @@ id = (string)Str::uuid(); + $model->id = (string) Str::uuid(); }); } } diff --git a/app/Models/User.php b/app/Models/User.php index d9b6ae6e..0c72af5e 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -1,20 +1,18 @@ 'string', + 'id' => 'string', 'email_verified_at' => 'datetime', ]; protected $appends = [ 'used_capacity', - 'storage' + 'storage', ]; public $sortable = [ @@ -85,18 +83,17 @@ class User extends Authenticatable $is_storage_limit = $storage_limitation ? $storage_limitation : 1; // Get user storage usage - if (!$is_storage_limit) { - + if (! $is_storage_limit) { return [ - 'used' => $this->used_capacity, + 'used' => $this->used_capacity, 'used_formatted' => Metric::bytes($this->used_capacity)->format(), ]; } return [ - 'used' => (float)get_storage_fill_percentage($this->used_capacity, $this->settings->storage_capacity), - 'used_formatted' => get_storage_fill_percentage($this->used_capacity, $this->settings->storage_capacity) . '%', - 'capacity' => $this->settings->storage_capacity, + 'used' => (float) get_storage_fill_percentage($this->used_capacity, $this->settings->storage_capacity), + 'used_formatted' => get_storage_fill_percentage($this->used_capacity, $this->settings->storage_capacity) . '%', + 'capacity' => $this->settings->storage_capacity, 'capacity_formatted' => format_gigabytes($this->settings->storage_capacity), ]; } @@ -138,13 +135,13 @@ class User extends Authenticatable public function setBilling($billing) { $this->settings()->update([ - 'address' => $billing['billing_address'], - 'city' => $billing['billing_city'], - 'country' => $billing['billing_country'], - 'name' => $billing['billing_name'], + 'address' => $billing['billing_address'], + 'city' => $billing['billing_city'], + 'country' => $billing['billing_country'], + 'name' => $billing['billing_name'], 'phone_number' => $billing['billing_phone_number'], - 'postal_code' => $billing['billing_postal_code'], - 'state' => $billing['billing_state'], + 'postal_code' => $billing['billing_postal_code'], + 'state' => $billing['billing_state'], ]); return $this->settings; @@ -177,7 +174,7 @@ class User extends Authenticatable ]); $record->update([ - 'upload' => $record->upload + $file_size + 'upload' => $record->upload + $file_size, ]); } @@ -197,7 +194,7 @@ class User extends Authenticatable ]); $record->update([ - 'download' => $record->download + $file_size + 'download' => $record->download + $file_size, ]); } diff --git a/app/Models/UserSettings.php b/app/Models/UserSettings.php index 3140c73e..bfa99482 100644 --- a/app/Models/UserSettings.php +++ b/app/Models/UserSettings.php @@ -1,5 +1,4 @@ id = (string)Str::uuid(); + $model->id = (string) Str::uuid(); }); } } diff --git a/app/Notifications/ResetPassword.php b/app/Notifications/ResetPassword.php index 8225c344..87c77ce2 100644 --- a/app/Notifications/ResetPassword.php +++ b/app/Notifications/ResetPassword.php @@ -1,11 +1,9 @@ getMimeType()); + $file_mimetype = explode('/', $value->getMimeType()); return ! array_intersect($file_mimetype, $mimetype_blacklist); } @@ -27,6 +27,6 @@ class DisabledMimetypes implements Rule */ public function message() { - return 'Type of this mime type is not allowed.'; + return 'Type of this mime type is not allowed.'; } } diff --git a/app/Services/DemoService.php b/app/Services/DemoService.php index 2060f9f5..1abda2a1 100644 --- a/app/Services/DemoService.php +++ b/app/Services/DemoService.php @@ -1,22 +1,12 @@ 1, - 'id' => Str::uuid(), - 'parent_id' => random_int(1000, 9999), - 'name' => $request->name, - 'type' => 'folder', - 'author' => $request->user() ? 'user' : 'visitor', - 'items' => '0', - 'color' => isset($request->icon['color']) ? $request->icon['color'] : null, - 'emoji' => isset($request->icon['emoji']) ? $request->icon['emoji'] : null, + 'user_id' => 1, + 'id' => Str::uuid(), + 'parent_id' => random_int(1000, 9999), + 'name' => $request->name, + 'type' => 'folder', + 'author' => $request->user() ? 'user' : 'visitor', + 'items' => '0', + 'color' => isset($request->icon['color']) ? $request->icon['color'] : null, + 'emoji' => isset($request->icon['emoji']) ? $request->icon['emoji'] : null, 'updated_at' => now()->format('j M Y \a\t H:i'), 'created_at' => now()->format('j M Y \a\t H:i'), ]; @@ -51,17 +41,14 @@ class DemoService * @param $id * @return mixed */ - function rename_item($request, $id) + public function rename_item($request, $id) { // Get item if ($request->type === 'folder') { - $item = Folder::where('id', $id) ->where('user_id', 1) ->first(); - } else { - $item = File::where('id', $id) ->where('user_id', 1) ->first(); @@ -73,15 +60,13 @@ class DemoService $item->color = $request->icon['color'] ?? null; return $item; - - } else { - - return [ - 'id' => $request->id, - 'name' => $request->name, - 'type' => $request->type, - ]; } + + return [ + 'id' => $request->id, + 'name' => $request->name, + 'type' => $request->type, + ]; } /** @@ -91,7 +76,7 @@ class DemoService * @return array * @throws \Exception */ - function upload($request) + public function upload($request) { // File $file = $request->file('file'); @@ -101,16 +86,16 @@ class DemoService $filetype = get_file_type($file->getMimeType()); return [ - 'id' => Str::uuid(), - 'folder_id' => $request->parent_id, - 'thumbnail' => 'data:' . $request->file('file')->getMimeType() . ';base64, ' . base64_encode(file_get_contents($request->file('file'))), - 'name' => $file->getClientOriginalName(), - 'basename' => $filename, - 'mimetype' => $file->getClientOriginalExtension(), - 'filesize' => Metric::bytes($filesize)->format(), - 'type' => $filetype, - 'file_url' => 'https://vuefilemanager.hi5ve.digital/assets/vue-file-manager-preview.jpg', - 'author' => $request->user() ? 'user' : 'visitor', + 'id' => Str::uuid(), + 'folder_id' => $request->parent_id, + 'thumbnail' => 'data:' . $request->file('file')->getMimeType() . ';base64, ' . base64_encode(file_get_contents($request->file('file'))), + 'name' => $file->getClientOriginalName(), + 'basename' => $filename, + 'mimetype' => $file->getClientOriginalExtension(), + 'filesize' => Metric::bytes($filesize)->format(), + 'type' => $filetype, + 'file_url' => 'https://vuefilemanager.hi5ve.digital/assets/vue-file-manager-preview.jpg', + 'author' => $request->user() ? 'user' : 'visitor', 'created_at' => now()->format('j M Y \a\t H:i'), 'updated_at' => now()->format('j M Y \a\t H:i'), ]; @@ -122,8 +107,8 @@ class DemoService * @param $user * @return ResponseFactory|\Illuminate\Http\Response */ - function favourites($user) + public function favourites($user) { return $user->favouriteFolders->makeHidden(['pivot']); } -} \ No newline at end of file +} diff --git a/app/Services/FileManagerService.php b/app/Services/FileManagerService.php index cb3e657a..6dccb6aa 100644 --- a/app/Services/FileManagerService.php +++ b/app/Services/FileManagerService.php @@ -1,24 +1,22 @@ put("temp/{$file['basename']}", Storage::get("files/$requested_folder->user_id/{$file['basename']}")); @@ -70,7 +67,6 @@ class FileManagerService // Add files to zip foreach ($files as $file) { - $file_path = is_storage_driver('local') ? $disk_local->path("files/$requested_folder->user_id/{$file['basename']}") : $disk_local->path("temp/{$file['basename']}"); @@ -84,8 +80,7 @@ class FileManagerService $zip->close(); // Delete temporary files - if (!is_storage_driver('local')) { - + if (! is_storage_driver('local')) { foreach ($files as $file) { $disk_local->delete('temp/' . $file['basename']); } @@ -93,9 +88,9 @@ class FileManagerService // Store zip record return Zip::create([ - 'user_id' => $shared->user_id ?? Auth::id(), + 'user_id' => $shared->user_id ?? Auth::id(), 'shared_token' => $shared->token ?? null, - 'basename' => $zip_name, + 'basename' => $zip_name, ]); } @@ -113,8 +108,7 @@ class FileManagerService $disk_local = Storage::disk('local'); // Move file to local storage from external storage service - if (!is_storage_driver('local')) { - + if (! is_storage_driver('local')) { $files->each(function ($file) use ($disk_local) { try { $disk_local->put("temp/$file->basename", Storage::get("files/$file->user_id/$file->basename")); @@ -132,7 +126,6 @@ class FileManagerService // Add files to zip $files->each(function ($file) use ($zip, $disk_local) { - $file_path = is_storage_driver('local') ? $disk_local->path("files/$file->user_id/$file->basename") : $disk_local->path("temp/$file->basename"); @@ -144,7 +137,7 @@ class FileManagerService $zip->close(); // Delete temporary files - if (!is_storage_driver('local')) { + if (! is_storage_driver('local')) { $files->each(function ($file) use ($disk_local) { $disk_local->delete("temp/$file->basename"); }); @@ -152,9 +145,9 @@ class FileManagerService // Store zip record return Zip::create([ - 'user_id' => $shared->user_id ?? Auth::id(), + 'user_id' => $shared->user_id ?? Auth::id(), 'shared_token' => $shared->token ?? null, - 'basename' => $zip_name, + 'basename' => $zip_name, ]); } @@ -169,12 +162,12 @@ class FileManagerService { return Folder::create([ 'parent_id' => $request->parent_id, - 'author' => $shared ? 'visitor' : 'user', - 'user_id' => $shared ? $shared->user_id : Auth::id(), - 'name' => $request->name, - 'color' => $request->color ?? null, - 'emoji' => $request->emoji ?? null, - ]);; + 'author' => $shared ? 'visitor' : 'user', + 'user_id' => $shared ? $shared->user_id : Auth::id(), + 'name' => $request->name, + 'color' => $request->color ?? null, + 'emoji' => $request->emoji ?? null, + ]); } /** @@ -196,7 +189,7 @@ class FileManagerService // Rename item $item->update([ - 'name' => $request->name + 'name' => $request->name, ]); // Return updated item @@ -215,7 +208,6 @@ class FileManagerService { // Delete folder if ($item['type'] === 'folder') { - // Get folder $folder = Folder::withTrashed() ->with('folders') @@ -237,15 +229,13 @@ class FileManagerService ->delete(); // Soft delete items - if (!$item['force_delete']) { - + if (! $item['force_delete']) { // Soft delete folder record $folder->delete(); } // Force delete children files if ($item['force_delete']) { - // Get children folder ids $child_folders = filter_folders_ids($folder->trashed_folders, 'id'); @@ -256,7 +246,6 @@ class FileManagerService // Remove all children files foreach ($files as $file) { - // Delete file Storage::delete("/files/$file->user_id/$file->basename"); @@ -278,7 +267,6 @@ class FileManagerService // Delete item if ($item['type'] !== 'folder') { - // Get file $file = UserFile::withTrashed() ->find($id); @@ -295,7 +283,6 @@ class FileManagerService // Force delete file if ($item['force_delete']) { - // Delete file Storage::delete("/files/$file->user_id/$file->basename"); @@ -311,8 +298,7 @@ class FileManagerService } // Soft delete file - if (!$item['force_delete']) { - + if (! $item['force_delete']) { // Soft delete file $file->delete(); } @@ -328,10 +314,8 @@ class FileManagerService public function move($request, $to_id) { foreach ($request->items as $item) { - // Move folder if ($item['type'] === 'folder') { - Folder::find($item['id']) ->update(['parent_id' => $to_id]); } @@ -375,11 +359,12 @@ class FileManagerService $limit = get_setting('upload_limit'); // File size handling - if ($limit && $file_size > format_bytes($limit)) abort(413); + if ($limit && $file_size > format_bytes($limit)) { + abort(413); + } // If last then process file if ($request->boolean('is_last')) { - $metadata = get_image_meta_data($file); $disk_local = Storage::disk('local'); @@ -402,7 +387,7 @@ class FileManagerService $disk_local->move("chunks/$temp_filename", "files/$user_id/$disk_file_name"); // Move files to external storage - if (!is_storage_driver(['local'])) { + if (! is_storage_driver(['local'])) { $this->helper->move_file_to_external_storage($disk_file_name, $user_id); } @@ -412,16 +397,16 @@ class FileManagerService // Return new file return UserFile::create([ - 'mimetype' => get_file_type_from_mimetype($file_mimetype), - 'type' => get_file_type($file_mimetype), + 'mimetype' => get_file_type_from_mimetype($file_mimetype), + 'type' => get_file_type($file_mimetype), 'folder_id' => $request->folder_id, - 'metadata' => $metadata, - 'name' => $user_file_name, - 'basename' => $disk_file_name, - 'author' => $shared ? 'visitor' : 'user', + 'metadata' => $metadata, + 'name' => $user_file_name, + 'basename' => $disk_file_name, + 'author' => $shared ? 'visitor' : 'user', 'thumbnail' => $thumbnail, - 'filesize' => $file_size, - 'user_id' => $user_id, + 'filesize' => $file_size, + 'user_id' => $user_id, ]); } } @@ -461,4 +446,4 @@ class FileManagerService ]); } } -} \ No newline at end of file +} diff --git a/app/Services/HelperService.php b/app/Services/HelperService.php index 2978f4eb..ee721c0c 100644 --- a/app/Services/HelperService.php +++ b/app/Services/HelperService.php @@ -1,16 +1,15 @@ = 100) { - // Delete file Storage::disk('local') ->delete("chunks/$temp_filename"); @@ -123,7 +123,7 @@ class HelperService * @param string $file * @param string $user_id */ - function move_file_to_external_storage($file, $user_id): void + public function move_file_to_external_storage($file, $user_id): void { $disk_local = Storage::disk('local'); @@ -132,7 +132,6 @@ class HelperService // If file is bigger than 5.2MB then run multipart upload if ($filesize > 5242880) { - // Get driver $driver = \Storage::getDriver(); @@ -146,16 +145,13 @@ class HelperService // TODO: replace local files with temp folder $uploader = new MultipartUploader($client, config('filesystems.disks.local.root') . "/files/$user_id/$file", [ 'bucket' => $adapter->getBucket(), - 'key' => "/files/$user_id/$file" + 'key' => "/files/$user_id/$file", ]); try { - // Upload content $uploader->upload(); - } catch (MultipartUploadException $e) { - // Write error log Log::error($e->getMessage()); @@ -164,12 +160,10 @@ class HelperService throw new HttpException(409, $e->getMessage()); } - } else { - // Stream file object to s3 // TODO: replace local files with temp folder - Storage::putFileAs("files/$user_id", config('filesystems.disks.local.root') . "/files/$user_id/$file", $file, "private"); + Storage::putFileAs("files/$user_id", config('filesystems.disks.local.root') . "/files/$user_id/$file", $file, 'private'); } // Delete file after upload @@ -184,11 +178,10 @@ class HelperService * @param string $user_id * @return string|null */ - function create_image_thumbnail($file_path, $filename, $user_id) + public function create_image_thumbnail($file_path, $filename, $user_id) { // Create thumbnail from image if (in_array(Storage::disk('local')->mimeType($file_path), ['image/gif', 'image/jpeg', 'image/jpg', 'image/png', 'image/webp'])) { - // Get thumbnail name $thumbnail = "thumbnail-$filename"; @@ -207,7 +200,6 @@ class HelperService // Return thumbnail as svg file if (Storage::disk('local')->mimeType($file_path) === 'image/svg+xml') { - $thumbnail = $filename; } @@ -221,13 +213,13 @@ class HelperService * @param $user_id * @return mixed */ - function download_file($file, $user_id) + public function download_file($file, $user_id) { // Get file path $path = "files/$user_id/$file->basename"; // Check if file exist - if (!Storage::exists($path)) { + if (! Storage::exists($path)) { abort(404); } @@ -236,11 +228,11 @@ class HelperService return response() ->download(Storage::path($path), $pretty_name, [ - "Accept-Ranges" => "bytes", - "Content-Type" => Storage::mimeType($path), - "Content-Length" => Storage::size($path), - "Content-Range" => "bytes 0-600/" . Storage::size($path), - "Content-Disposition" => "attachment; filename=$pretty_name", + 'Accept-Ranges' => 'bytes', + 'Content-Type' => Storage::mimeType($path), + 'Content-Length' => Storage::size($path), + 'Content-Range' => 'bytes 0-600/' . Storage::size($path), + 'Content-Disposition' => "attachment; filename=$pretty_name", ]); } @@ -251,13 +243,15 @@ class HelperService * @param $user_id * @return mixed */ - function download_thumbnail_file($file, $user_id) + public function download_thumbnail_file($file, $user_id) { // Get file path $path = "/files/$user_id/{$file->getRawOriginal('thumbnail')}"; // Check if file exist - if (!Storage::exists($path)) abort(404); + if (! Storage::exists($path)) { + abort(404); + } // Return image thumbnail return Storage::download($path, $file->getRawOriginal('thumbnail')); @@ -270,7 +264,7 @@ class HelperService * @param $shared * @return array */ - function get_items_under_shared_by_folder_id($id, $shared): array + public function get_items_under_shared_by_folder_id($id, $shared): array { $folders = Folder::where('user_id', $shared->user_id) ->where('parent_id', $id) @@ -288,13 +282,12 @@ class HelperService /** * @param Share $shared */ - function check_protected_share_record(Share $shared): void + public function check_protected_share_record(Share $shared): void { if ($shared->is_protected) { - $abort_message = "Sorry, you don't have permission"; - if (!request()->hasCookie('share_session')) { + if (! request()->hasCookie('share_session')) { abort(403, $abort_message); } @@ -309,9 +302,9 @@ class HelperService } // Check if share record was authenticated previously via ShareController@authenticate - if (!$share_session->authenticated) { + if (! $share_session->authenticated) { abort(403, $abort_message); } } } -} \ No newline at end of file +} diff --git a/app/Services/LanguageService.php b/app/Services/LanguageService.php index e85ddab4..4216dd35 100644 --- a/app/Services/LanguageService.php +++ b/app/Services/LanguageService.php @@ -1,12 +1,9 @@ collect([ - config("language-translations.extended"), - config("language-translations.regular"), - config("custom-language-translations") + config('language-translations.extended'), + config('language-translations.regular'), + config('custom-language-translations'), ])->collapse(), - 'regular' => collect([ - config("language-translations.regular"), - config("custom-language-translations") + 'regular' => collect([ + config('language-translations.regular'), + config('custom-language-translations'), ])->collapse(), ]; $translations = $translations[strtolower($license)] ->map(function ($value, $key) use ($locale) { return [ - 'lang' => $locale, + 'lang' => $locale, 'value' => $value, - 'key' => $key, + 'key' => $key, ]; })->toArray(); @@ -45,7 +42,7 @@ class LanguageService * Find newly added translations in default language * translations file and insert it into database */ - function upgrade_language_translations() + public function upgrade_language_translations() { // Get all app locales $locales = Language::all() @@ -57,13 +54,13 @@ class LanguageService $default_translations = [ 'extended' => collect([ - config("language-translations.extended"), - config("language-translations.regular"), - config("custom-language-translations") + config('language-translations.extended'), + config('language-translations.regular'), + config('custom-language-translations'), ])->collapse(), - 'regular' => collect([ - config("language-translations.regular"), - config("custom-language-translations") + 'regular' => collect([ + config('language-translations.regular'), + config('custom-language-translations'), ])->collapse(), ]; @@ -75,13 +72,12 @@ class LanguageService // Store new translations for every language $locales->each(function ($locale) use ($newbies) { - $translations = $newbies ->map(function ($value, $key) use ($locale) { return [ - 'lang' => $locale, + 'lang' => $locale, 'value' => $value, - 'key' => $key, + 'key' => $key, ]; })->toArray(); @@ -93,4 +89,4 @@ class LanguageService cache()->forget("language-translations-$locale"); }); } -} \ No newline at end of file +} diff --git a/app/Services/SchedulerService.php b/app/Services/SchedulerService.php index 168a8a5e..ad09fbca 100644 --- a/app/Services/SchedulerService.php +++ b/app/Services/SchedulerService.php @@ -1,12 +1,9 @@ subDay()->toDateTimeString()) ->get() ->each(function ($zip) { - // Delete zip file \Storage::disk('local')->delete("zip/$zip->basename"); @@ -37,7 +33,6 @@ class SchedulerService Share::whereNotNull('expire_in') ->get() ->each(function ($share) { - // Get dates $created_at = Carbon::parse($share->created_at); @@ -58,11 +53,10 @@ class SchedulerService // Get all files from storage $files = collect([ //$local_disk->allFiles('files'), - $local_disk->allFiles('chunks') + $local_disk->allFiles('chunks'), ])->collapse(); $files->each(function ($file) use ($local_disk) { - // Get the file's last modification time. $last_modified = $local_disk ->lastModified($file); @@ -73,7 +67,6 @@ class SchedulerService // Delete if file is in local storage more than 24 hours if ($diff >= 24) { - Log::info("Failed file or chunk $file deleted."); // Delete file from local storage @@ -81,4 +74,4 @@ class SchedulerService } }); } -} \ No newline at end of file +} diff --git a/app/Services/SetupService.php b/app/Services/SetupService.php index 2dd4c6a5..328e5c1f 100644 --- a/app/Services/SetupService.php +++ b/app/Services/SetupService.php @@ -1,10 +1,9 @@ each(function ($directory) { - // Create directory for local driver Storage::disk('local') ->makeDirectory($directory); @@ -58,13 +56,13 @@ class SetupService public function seed_default_language() { Language::create([ - 'name' => 'English', - 'locale' => 'en' + 'name' => 'English', + 'locale' => 'en', ]); Setting::create([ - 'name' => 'language', + 'name' => 'language', 'value' => 'en', ]); } -} \ No newline at end of file +} diff --git a/app/Services/StripeService.php b/app/Services/StripeService.php index 299e88a2..46a47bec 100644 --- a/app/Services/StripeService.php +++ b/app/Services/StripeService.php @@ -1,16 +1,14 @@ getTaxRates() as $rate) { - // Continue when is not active - if (!$rate['active']) continue; + if (! $rate['active']) { + continue; + } // Calculate tax $tax = $amount * ($rate['percentage'] / 100); array_push($rates_public, [ - 'id' => $rate['id'], - 'active' => $rate['active'], - 'country' => $rate['country'], - 'percentage' => $rate['percentage'], + 'id' => $rate['id'], + 'active' => $rate['active'], + 'country' => $rate['country'], + 'percentage' => $rate['percentage'], 'plan_price_formatted' => Cashier::formatAmount(round($amount + $tax)), ]); } @@ -89,8 +88,7 @@ class StripeService public function getOrSetDefaultPaymentMethod($request, $user) { // Check payment method - if (!$request->has('payment.meta.pm') && $user->hasDefaultPaymentMethod()) { - + if (! $request->has('payment.meta.pm') && $user->hasDefaultPaymentMethod()) { // Get default payment return $user->defaultPaymentMethod()->paymentMethod; } @@ -98,23 +96,18 @@ class StripeService // Clear cached payment methods cache_forget_many([ 'payment-methods-user-' . $user->id, - 'default-payment-methods-user-' . $user->id + 'default-payment-methods-user-' . $user->id, ]); if ($request->has('payment.meta.pm') && $user->hasDefaultPaymentMethod()) { - // Set new payment return $user->addPaymentMethod($request->input('payment.meta.pm'))->paymentMethod; - - } else if ($request->has('payment.meta.pm') && !$user->hasDefaultPaymentMethod()) { - + } elseif ($request->has('payment.meta.pm') && ! $user->hasDefaultPaymentMethod()) { // Set new payment return $user->updateDefaultPaymentMethod($request->input('payment.meta.pm'))->paymentMethod; - - } else { - - throw new HttpException(400, 'Something went wrong.'); } + + throw new HttpException(400, 'Something went wrong.'); } /** @@ -129,7 +122,7 @@ class StripeService // Clear cached payment methods cache_forget_many([ 'payment-methods-user-' . $user->id, - 'default-payment-methods-user-' . $user->id + 'default-payment-methods-user-' . $user->id, ]); // Set new payment method @@ -152,33 +145,25 @@ class StripeService public function createOrReplaceSubscription($request, $user) { try { - // Get payment method $paymentMethod = $this->getOrSetDefaultPaymentMethod($request, $user); // Check if user have subscription if ($user->subscribed('main')) { - // Change subscription plan $user->subscription('main')->skipTrial()->swap($request->input('plan.data.id')); - } else { - // Create subscription $user->newSubscription('main', $request->input('plan.data.id'))->create($paymentMethod); } - } catch (IncompletePayment $exception) { - if ($exception instanceof PaymentActionRequired) { - $cashier_route = route('cashier.payment', [$exception->payment->id, 'redirect' => url('/settings/subscription')]); throw new HttpException(402, $cashier_route); - } else { - throw new HttpException(400, $exception->getMessage()); } + throw new HttpException(400, $exception->getMessage()); } } @@ -190,18 +175,18 @@ class StripeService public function updateCustomerDetails($user) { $user->updateStripeCustomer([ - 'name' => $user->settings->name, - 'phone' => $user->settings->phone_number, + 'name' => $user->settings->name, + 'phone' => $user->settings->phone_number, 'address' => [ - 'line1' => $user->settings->address, - 'city' => $user->settings->city, - 'country' => $user->settings->country, + 'line1' => $user->settings->address, + 'city' => $user->settings->city, + 'country' => $user->settings->country, 'postal_code' => $user->settings->postal_code, - 'state' => $user->settings->state, + 'state' => $user->settings->state, ], 'preferred_locales' => [ - $user->settings->country, 'en' - ] + $user->settings->country, 'en', + ], ]); } @@ -219,14 +204,13 @@ class StripeService $plans = []; foreach ($stripe_plans['data'] as $plan) { - // Get stripe product $product = $this->stripe->products()->find($plan['product']); // Push data to $plan container if ($product['active'] && isset($product['metadata']['capacity'])) { array_push($plans, [ - 'plan' => $plan, + 'plan' => $plan, 'product' => $product, ]); } @@ -249,16 +233,14 @@ class StripeService $plans = []; foreach ($stripe_plans['data'] as $plan) { - if ($plan['active']) { - // Get stripe product $product = $this->stripe->products()->find($plan['product']); // Push data to $plan container if ($product['active'] && isset($product['metadata']['capacity'])) { array_push($plans, [ - 'plan' => $plan, + 'plan' => $plan, 'product' => $product, ]); } @@ -281,12 +263,11 @@ class StripeService } return Cache::rememberForever("plan-$id", function () use ($id) { - $plan = $this->stripe->plans()->find($id); $product = $this->stripe->products()->find($plan['product']); return [ - 'plan' => $plan, + 'plan' => $plan, 'product' => $product, ]; }); @@ -302,34 +283,34 @@ class StripeService { if ($data instanceof Request) { $plan = [ - 'name' => $data->input('attributes.name'), + 'name' => $data->input('attributes.name'), 'description' => $data->input('attributes.description'), - 'price' => $data->input('attributes.price'), - 'capacity' => $data->input('attributes.capacity'), + 'price' => $data->input('attributes.price'), + 'capacity' => $data->input('attributes.capacity'), ]; } else { $plan = [ - 'name' => $data['attributes']['name'], + 'name' => $data['attributes']['name'], 'description' => $data['attributes']['description'], - 'price' => $data['attributes']['price'], - 'capacity' => $data['attributes']['capacity'], + 'price' => $data['attributes']['price'], + 'capacity' => $data['attributes']['capacity'], ]; } $product = $this->stripe->products()->create([ - 'name' => $plan['name'], + 'name' => $plan['name'], 'description' => $plan['description'], - 'metadata' => [ - 'capacity' => $plan['capacity'] - ] + 'metadata' => [ + 'capacity' => $plan['capacity'], + ], ]); $plan = $this->stripe->plans()->create([ - 'id' => Str::slug($plan['name']), - 'amount' => $plan['price'], + 'id' => Str::slug($plan['name']), + 'amount' => $plan['price'], 'currency' => config('cashier.currency'), 'interval' => 'month', - 'product' => $product['id'], + 'product' => $product['id'], ]); return compact('plan', 'product'); @@ -350,13 +331,14 @@ class StripeService // Update product if (in_array($request->name, $product_colls)) { - if ($request->name === 'capacity') { $this->stripe->products()->update($plan['product'], ['metadata' => ['capacity' => $request->value]]); } + if ($request->name === 'name') { $this->stripe->products()->update($plan['product'], ['name' => $request->value]); } + if ($request->name === 'description') { $this->stripe->products()->update($plan['product'], ['description' => $request->value]); } @@ -364,7 +346,6 @@ class StripeService // Update plan if (in_array($request->name, $plan_colls)) { - if ($request->name === 'is_active') { $this->stripe->plans()->update($id, ['active' => $request->value]); } @@ -421,7 +402,7 @@ class StripeService ->stripe ->invoices() ->all([ - 'limit' => 20 + 'limit' => 20, ]); } -} \ No newline at end of file +} diff --git a/config/app.php b/config/app.php index eed216b8..359a3d4f 100644 --- a/config/app.php +++ b/config/app.php @@ -1,7 +1,6 @@ [ - /* * Laravel Framework Service Providers... */ @@ -179,7 +177,6 @@ return [ // App\Providers\BroadcastServiceProvider::class, App\Providers\EventServiceProvider::class, App\Providers\RouteServiceProvider::class, - ], /* @@ -194,45 +191,44 @@ return [ */ 'aliases' => [ - - 'App' => Illuminate\Support\Facades\App::class, - 'Arr' => Illuminate\Support\Arr::class, - 'Artisan' => Illuminate\Support\Facades\Artisan::class, - 'Auth' => Illuminate\Support\Facades\Auth::class, - 'Blade' => Illuminate\Support\Facades\Blade::class, - 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, - 'Bus' => Illuminate\Support\Facades\Bus::class, - 'Cache' => Illuminate\Support\Facades\Cache::class, - 'Config' => Illuminate\Support\Facades\Config::class, - 'Cookie' => Illuminate\Support\Facades\Cookie::class, - 'Crypt' => Illuminate\Support\Facades\Crypt::class, - 'DB' => Illuminate\Support\Facades\DB::class, - 'Eloquent' => Illuminate\Database\Eloquent\Model::class, - 'Event' => Illuminate\Support\Facades\Event::class, - 'File' => Illuminate\Support\Facades\File::class, - 'Gate' => Illuminate\Support\Facades\Gate::class, - 'Hash' => Illuminate\Support\Facades\Hash::class, - 'Lang' => Illuminate\Support\Facades\Lang::class, - 'Log' => Illuminate\Support\Facades\Log::class, - 'Mail' => Illuminate\Support\Facades\Mail::class, + 'App' => Illuminate\Support\Facades\App::class, + 'Arr' => Illuminate\Support\Arr::class, + 'Artisan' => Illuminate\Support\Facades\Artisan::class, + 'Auth' => Illuminate\Support\Facades\Auth::class, + 'Blade' => Illuminate\Support\Facades\Blade::class, + 'Broadcast' => Illuminate\Support\Facades\Broadcast::class, + 'Bus' => Illuminate\Support\Facades\Bus::class, + 'Cache' => Illuminate\Support\Facades\Cache::class, + 'Config' => Illuminate\Support\Facades\Config::class, + 'Cookie' => Illuminate\Support\Facades\Cookie::class, + 'Crypt' => Illuminate\Support\Facades\Crypt::class, + 'DB' => Illuminate\Support\Facades\DB::class, + 'Eloquent' => Illuminate\Database\Eloquent\Model::class, + 'Event' => Illuminate\Support\Facades\Event::class, + 'File' => Illuminate\Support\Facades\File::class, + 'Gate' => Illuminate\Support\Facades\Gate::class, + 'Hash' => Illuminate\Support\Facades\Hash::class, + 'Lang' => Illuminate\Support\Facades\Lang::class, + 'Log' => Illuminate\Support\Facades\Log::class, + 'Mail' => Illuminate\Support\Facades\Mail::class, 'Notification' => Illuminate\Support\Facades\Notification::class, - 'Password' => Illuminate\Support\Facades\Password::class, - 'Queue' => Illuminate\Support\Facades\Queue::class, - 'Redirect' => Illuminate\Support\Facades\Redirect::class, - 'Redis' => Illuminate\Support\Facades\Redis::class, - 'Request' => Illuminate\Support\Facades\Request::class, - 'Response' => Illuminate\Support\Facades\Response::class, - 'Route' => Illuminate\Support\Facades\Route::class, - 'Schema' => Illuminate\Support\Facades\Schema::class, - 'Session' => Illuminate\Support\Facades\Session::class, - 'Storage' => Illuminate\Support\Facades\Storage::class, - 'Str' => Illuminate\Support\Str::class, - 'URL' => Illuminate\Support\Facades\URL::class, - 'Validator' => Illuminate\Support\Facades\Validator::class, - 'View' => Illuminate\Support\Facades\View::class, - 'Image' => Intervention\Image\Facades\Image::class, - 'Stripe' => Cartalyst\Stripe\Laravel\Facades\Stripe::class, - 'Crawler' => Jaybizzle\LaravelCrawlerDetect\Facades\LaravelCrawlerDetect::class, + 'Password' => Illuminate\Support\Facades\Password::class, + 'Queue' => Illuminate\Support\Facades\Queue::class, + 'Redirect' => Illuminate\Support\Facades\Redirect::class, + 'Redis' => Illuminate\Support\Facades\Redis::class, + 'Request' => Illuminate\Support\Facades\Request::class, + 'Response' => Illuminate\Support\Facades\Response::class, + 'Route' => Illuminate\Support\Facades\Route::class, + 'Schema' => Illuminate\Support\Facades\Schema::class, + 'Session' => Illuminate\Support\Facades\Session::class, + 'Storage' => Illuminate\Support\Facades\Storage::class, + 'Str' => Illuminate\Support\Str::class, + 'URL' => Illuminate\Support\Facades\URL::class, + 'Validator' => Illuminate\Support\Facades\Validator::class, + 'View' => Illuminate\Support\Facades\View::class, + 'Image' => Intervention\Image\Facades\Image::class, + 'Stripe' => Cartalyst\Stripe\Laravel\Facades\Stripe::class, + 'Crawler' => Jaybizzle\LaravelCrawlerDetect\Facades\LaravelCrawlerDetect::class, 'Madzipper' => Madnest\Madzipper\Madzipper::class, ], @@ -240,7 +236,7 @@ return [ 'deploy_branch' => env('APP_DEPLOY_BRANCH'), 'debug_blacklist' => [ - '_ENV' => [ + '_ENV' => [ 'APP_KEY', 'DB_USERNAME', @@ -292,9 +288,8 @@ return [ 'BACKBLAZE_KEY', 'BACKBLAZE_SECRET', ], - '_POST' => [ + '_POST' => [ 'password', ], ], - ]; diff --git a/config/auth.php b/config/auth.php index ba1a4d8c..d97282db 100644 --- a/config/auth.php +++ b/config/auth.php @@ -1,7 +1,6 @@ 10800, - ]; diff --git a/config/backup.php b/config/backup.php index 9cf5b964..1db4d3bf 100644 --- a/config/backup.php +++ b/config/backup.php @@ -1,9 +1,7 @@ [ - /* * The name of this application. You can use this name to monitor * the backups. @@ -11,9 +9,7 @@ return [ 'name' => 'app-backup', 'source' => [ - 'files' => [ - /* * The list of directories and files that will be included in the backup. */ @@ -106,7 +102,6 @@ return [ 'database_dump_file_extension' => '', 'destination' => [ - /* * The filename prefix used for the backup zip file. */ @@ -149,7 +144,6 @@ return [ * the `Spatie\Backup\Events` classes. */ 'notifications' => [ - 'notifications' => [ \Spatie\Backup\Notifications\Notifications\BackupHasFailed::class => ['mail'], \Spatie\Backup\Notifications\Notifications\UnhealthyBackupWasFound::class => ['mail'], @@ -185,7 +179,6 @@ return [ 'username' => null, 'icon' => null, - ], ], @@ -229,7 +222,6 @@ return [ 'strategy' => \Spatie\Backup\Tasks\Cleanup\Strategies\DefaultStrategy::class, 'default_strategy' => [ - /* * The number of days for which backups must be kept. */ @@ -262,5 +254,4 @@ return [ 'delete_oldest_backups_when_using_more_megabytes_than' => 5000, ], ], - ]; diff --git a/config/broadcasting.php b/config/broadcasting.php index 3bba1103..567e3f76 100644 --- a/config/broadcasting.php +++ b/config/broadcasting.php @@ -1,7 +1,6 @@ [ - 'pusher' => [ 'driver' => 'pusher', 'key' => env('PUSHER_APP_KEY'), @@ -53,7 +51,5 @@ return [ 'null' => [ 'driver' => 'null', ], - ], - ]; diff --git a/config/cache.php b/config/cache.php index 46751e62..43bb1a43 100644 --- a/config/cache.php +++ b/config/cache.php @@ -3,7 +3,6 @@ use Illuminate\Support\Str; return [ - /* |-------------------------------------------------------------------------- | Default Cache Store @@ -32,7 +31,6 @@ return [ */ 'stores' => [ - 'apc' => [ 'driver' => 'apc', ], @@ -84,7 +82,6 @@ return [ 'table' => env('DYNAMODB_CACHE_TABLE', 'cache'), 'endpoint' => env('DYNAMODB_ENDPOINT'), ], - ], /* @@ -99,5 +96,4 @@ return [ */ 'prefix' => env('CACHE_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_').'_cache'), - ]; diff --git a/config/cashier.php b/config/cashier.php index bb2fd137..76759dc7 100644 --- a/config/cashier.php +++ b/config/cashier.php @@ -1,7 +1,6 @@ env('CASHIER_LOGGER'), - ]; diff --git a/config/content.php b/config/content.php index 83596404..9c122b7c 100644 --- a/config/content.php +++ b/config/content.php @@ -1,182 +1,182 @@ [ + 'pages' => [ [ 'visibility' => 1, - 'title' => 'Terms of Service', - 'slug' => 'terms-of-service', - 'content' => 'Laoreet cum hendrerit iaculis arcu phasellus congue et elementum, pharetra risus imperdiet aptent posuere rutrum parturient blandit, dapibus tellus ridiculus potenti aliquam sociis turpis. Nullam commodo eget laoreet risus cursus vel placerat, in dapibus sociis gravida faucibus sodales, fringilla potenti elit semper iaculis ullamcorper. Dignissim vulputate pretium montes pellentesque mollis, consectetur adipiscing curabitur semper sem rhoncus, litora viverra curae proin.', + 'title' => 'Terms of Service', + 'slug' => 'terms-of-service', + 'content' => 'Laoreet cum hendrerit iaculis arcu phasellus congue et elementum, pharetra risus imperdiet aptent posuere rutrum parturient blandit, dapibus tellus ridiculus potenti aliquam sociis turpis. Nullam commodo eget laoreet risus cursus vel placerat, in dapibus sociis gravida faucibus sodales, fringilla potenti elit semper iaculis ullamcorper. Dignissim vulputate pretium montes pellentesque mollis, consectetur adipiscing curabitur semper sem rhoncus, litora viverra curae proin.', ], [ 'visibility' => 1, - 'title' => 'Privacy Policy', - 'slug' => 'privacy-policy', - 'content' => 'Sit orci justo augue maecenas laoreet consectetur natoque magnis in viverra sagittis, himenaeos urna facilisis mus proin primis diam accumsan tristique inceptos. Primis quisque posuere sit praesent lobortis feugiat semper convallis facilisis, vivamus gravida ligula nostra curae eu donec duis parturient senectus, arcu dolor viverra penatibus natoque cum nisi commodo. Litora sociis mauris justo nullam suspendisse mattis maecenas nascetur congue phasellus cras ultricies posuere donec, dapibus egestas diam lacus ornare montes senectus tincidunt eu taciti sed consequat.', + 'title' => 'Privacy Policy', + 'slug' => 'privacy-policy', + 'content' => 'Sit orci justo augue maecenas laoreet consectetur natoque magnis in viverra sagittis, himenaeos urna facilisis mus proin primis diam accumsan tristique inceptos. Primis quisque posuere sit praesent lobortis feugiat semper convallis facilisis, vivamus gravida ligula nostra curae eu donec duis parturient senectus, arcu dolor viverra penatibus natoque cum nisi commodo. Litora sociis mauris justo nullam suspendisse mattis maecenas nascetur congue phasellus cras ultricies posuere donec, dapibus egestas diam lacus ornare montes senectus tincidunt eu taciti sed consequat.', ], [ 'visibility' => 1, - 'title' => 'Cookie Policy', - 'slug' => 'cookie-policy', - 'content' => 'Metus penatibus ligula dolor natoque non habitasse laoreet facilisis, libero vivamus eget semper vulputate interdum integer, phasellus lorem enim blandit consectetur nullam sollicitudin. Hendrerit interdum luctus ut in molestie himenaeos eros cum laoreet parturient est, eu lectus hac et netus viverra dictumst congue elit sem senectus litora, fames scelerisque adipiscing inceptos fringilla montes sociosqu suscipit auctor potenti. Elementum lacus vulputate viverra ac morbi ligula ipsum facilisi, sit eu imperdiet lacinia congue dis vitae.', + 'title' => 'Cookie Policy', + 'slug' => 'cookie-policy', + 'content' => 'Metus penatibus ligula dolor natoque non habitasse laoreet facilisis, libero vivamus eget semper vulputate interdum integer, phasellus lorem enim blandit consectetur nullam sollicitudin. Hendrerit interdum luctus ut in molestie himenaeos eros cum laoreet parturient est, eu lectus hac et netus viverra dictumst congue elit sem senectus litora, fames scelerisque adipiscing inceptos fringilla montes sociosqu suscipit auctor potenti. Elementum lacus vulputate viverra ac morbi ligula ipsum facilisi, sit eu imperdiet lacinia congue dis vitae.', ], ], 'content' => [ - 'regular' => [ + 'regular' => [ [ - 'name' => 'section_features', + 'name' => 'section_features', 'value' => 1, ], [ - 'name' => 'section_feature_boxes', + 'name' => 'section_feature_boxes', 'value' => 1, ], [ - 'name' => 'section_get_started', + 'name' => 'section_get_started', 'value' => 1, ], [ - 'name' => 'header_title', + 'name' => 'header_title', 'value' => 'Simple & Powerful Personal Cloud Storage', ], [ - 'name' => 'header_description', + 'name' => 'header_description', 'value' => 'Your private cloud storage software build on Laravel & Vue.js. No limits & no monthly fees. Truly freedom.', ], [ - 'name' => 'features_title', + 'name' => 'features_title', 'value' => 'The Fastest Growing File Manager on the CodeCanyon Market', ], [ - 'name' => 'features_description', + 'name' => 'features_description', 'value' => 'Your private cloud storage software build on Laravel & Vue.js. No limits & no monthly fees. Truly freedom.', ], [ - 'name' => 'feature_title_1', + 'name' => 'feature_title_1', 'value' => 'Truly Freedom', ], [ - 'name' => 'feature_description_1', + 'name' => 'feature_description_1', 'value' => 'You have full control over VueFileManager, no third authorities will control your service or usage, only you.', ], [ - 'name' => 'feature_title_2', + 'name' => 'feature_title_2', 'value' => 'The Sky is the Limit', ], [ - 'name' => 'feature_description_2', + 'name' => 'feature_description_2', 'value' => 'VueFileManager is cloud storage software. You have to install and running application on your own server hosting.', ], [ - 'name' => 'feature_title_3', + 'name' => 'feature_title_3', 'value' => 'No Monthly Fees', ], [ - 'name' => 'feature_description_3', + 'name' => 'feature_description_3', 'value' => 'When you running VueFileManager on your own server hosting, anybody can\'t control your content or resell your user data. Your data is safe.', ], [ - 'name' => 'get_started_title', + 'name' => 'get_started_title', 'value' => 'Ready to Get Started