settings->get(Setting::AllowedUploadExtensions); return Inertia::render('system/settings/uploads', [ 'max_file_size_mb' => $this->settings->get(Setting::MaxFileSizeMb), 'upload_type_restriction' => $this->settings->get(Setting::UploadTypeRestriction), 'allowed_upload_extensions' => is_array($allowedExtensions) ? $allowedExtensions : [], ]); } public function update(Request $request): RedirectResponse { $validated = $request->validate([ 'max_file_size_mb' => ['required', 'integer', 'min:0', 'max:1048576'], 'upload_type_restriction' => ['required', Rule::enum(UploadTypeRestriction::class)], 'allowed_upload_extensions' => ['required', 'array', 'min:1'], 'allowed_upload_extensions.*' => ['string', 'max:15', 'regex:/^[a-z0-9]+$/i'], ]); $allowedExtensions = array_values(array_unique(array_map( fn (string $extension): string => strtolower($extension), $validated['allowed_upload_extensions'], ))); $this->settings->set(Setting::MaxFileSizeMb, (int) $validated['max_file_size_mb']); $this->settings->set(Setting::UploadTypeRestriction, $validated['upload_type_restriction']); $this->settings->set(Setting::AllowedUploadExtensions, $allowedExtensions); $this->activity->log(Action::SettingsUpdated, context: ['section' => 'uploads']); $dangerous = array_intersect($allowedExtensions, self::DANGEROUS_EXTENSIONS); if ($dangerous !== []) { return back()->with('success', __( 'Upload settings saved. Warning: :extensions can be dangerous to allow — only keep them on the list if you understand the risk.', ['extensions' => implode(', ', $dangerous)], )); } return back()->with('success', __('Upload settings saved.')); } }