From c54b29c559a67b96a02221dfa01d0d8bc2d02828 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sun, 12 Jul 2020 21:25:11 -0600 Subject: [PATCH] Added MediaPathService --- app/Services/MediaPathService.php | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 app/Services/MediaPathService.php diff --git a/app/Services/MediaPathService.php b/app/Services/MediaPathService.php new file mode 100644 index 000000000..c8ae1422f --- /dev/null +++ b/app/Services/MediaPathService.php @@ -0,0 +1,51 @@ +id . (string) $account->created_at); + $path = "public/m/{$monthHash}/{$userHash}"; + break; + + case 2: + $monthHash = substr($mh, 0, 9).'-'.substr($mh, 9, 6); + $userHash = $account->profile_id; + $random = Str::random(12); + $path = "public/m/_v2/{$userHash}/{$monthHash}/{$random}"; + break; + + default: + $monthHash = substr($mh, 0, 9).'-'.substr($mh, 9, 6); + $userHash = $account->profile_id; + $random = Str::random(12); + $path = "public/m/_v2/{$userHash}/{$monthHash}/{$random}"; + break; + } + } + if($account instanceOf Profile) { + $monthHash = substr($mh, 0, 9).'-'.substr($mh, 9, 6); + $userHash = $account->id; + $random = Str::random(12); + $path = "public/m/_v2/{$userHash}/{$monthHash}/{$random}"; + } + return $path; + } + +} \ No newline at end of file