feat(accounting): document colleague trades on configured accounts

Post Montzar-covered buy/sell to Zarin/Tahesab/Pargar using montzar_account_* settings, and harden public storage URL/MIME handling for uploads.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-26 16:59:27 +03:30
co-authored by Cursor
parent ad78545ebd
commit 885ed33e6e
10 changed files with 457 additions and 34 deletions
@@ -50,9 +50,37 @@ class PublicStorageController extends Controller
*/
private function candidatePaths(string $path): array
{
return [
storage_path('app/public/'.$path),
public_path('storage/'.$path),
];
$relative = [$path, ...$this->alternateExtensionPaths($path)];
$full = [];
foreach ($relative as $rel) {
$full[] = storage_path('app/public/'.$rel);
$full[] = storage_path('app/public/storage/'.$rel);
$full[] = public_path('storage/'.$rel);
}
return $full;
}
/**
* آپلود ادمین WebP می‌سازد ولی const گاهی همان هش را با .png نگه می‌دارد.
*
* @return list<string>
*/
private function alternateExtensionPaths(string $path): array
{
if (! preg_match('/^(.*)\.([a-z0-9]+)$/i', $path, $matches)) {
return [];
}
$stem = $matches[1];
$ext = strtolower($matches[2]);
$out = [];
foreach (['webp', 'png', 'jpg', 'jpeg', 'gif'] as $alt) {
if ($alt !== $ext) {
$out[] = $stem.'.'.$alt;
}
}
return $out;
}
}