Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage Gallery #9

Open
yuridimas opened this issue Jul 20, 2023 · 0 comments
Open

Manage Gallery #9

yuridimas opened this issue Jul 20, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@yuridimas
Copy link

yuridimas commented Jul 20, 2023

Table galleries {
  id unsignedbiginteger [pk]
  uuid string
  model_id unsignedbiginteger
  model_type string
  file string // "cncknwk.png"
  path string // "/avatar/20230723/"
}

Gallery menyimpan semua bentuk file yang diunggah dari model Product, Merchant dan User maka dari itu relasi yang diterapkan adalah One To Many (Polymorphic Relationship). Buatkan function helper global uploadFile, removeFile menggunakan package https://github.com/browner12/helpers

Attribute file menyimpan fileContent yang diunggah dan nama file dimodifikasi sesuai dengan ketentuan berikut:

$timeStamp = now()->timestamp;
$stringRandom = Str::random(15);
$extenstion = $request->getClientOriginalExtension();
$fileName = $timeStamp.'_'.$stringRandom.'.'.$extension;
// 284284787_wjnfjb3kjbrjqjfTbjw.png

Sedangkan path menyimpan path folder sesuai dengan pemilik table dan sub path adalah tanggal sekarang, contoh

Model Path
User '/users/20230720/'
Product '/products/20230720/'
Merchant '/merchants/20230720/'
@baralogi baralogi added the enhancement New feature or request label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants