itskodinger / midia

Simple Media manager for your Laravel project
MIT License
139 stars 35 forks source link

How can I integrate for Model per Media. #11

Open naingyy opened 6 years ago

naingyy commented 6 years ago

Awesome packages.

My problem is may be I have a "Post" model and one post may have may media like images,pdf,docx..etc. I want to show only specific media for each post.

how can archive my problem with this package? Thanks.

nauvalazhar commented 6 years ago

Hi, for now, it can't, unless you use the search feature with the extension keyword. For example: .pdf, .png, .jpg and others. I will try to implement it in the next feature. Thank you

naingyy commented 6 years ago

Hi @nauvalazhar,

Thanks for your discussion.I happy to wait next feature. I'm thinking about my problem with your package current version with specific directory per model.but its may work or not.I'm not sure.

Thanks!

tpaksu commented 5 years ago

https://github.com/itskodinger/midia/blob/da391cff0c70b964bb6fd9a944f69503d79dbf3f/src/Controller/MidiaController.php#L18-L20

This may be your entry point. You can open your window with that parameter or initialize your midia js instance with directory_name parameter

https://github.com/itskodinger/midia/blob/da391cff0c70b964bb6fd9a944f69503d79dbf3f/src/Public/midia.js#L87-L89

This way you can use your post ID as a directory name. Didn't try, but it should work. The code says it overrides the directory name with the specified one if it's not set in config directories.