G
G
GaserV2017-06-04 23:13:32
Laravel
GaserV, 2017-06-04 23:13:32

How to synchronize background download of files when creating a post?

Hello! Such situation. When creating a post, there is a zone for dropping files. After the drop, they are immediately loaded. So. How do I attach uploaded files to a post? Return an array of IDs and store them in the post field, say files, but then it will be a bit of a hassle when outputting. Gentlemen, please share your experience)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hakkol, 2017-06-05
@hakkol

What's stopping you from using relationships ( https://laravel.com/docs/5.2/eloquent-relationships)? If you have a lot of pictures for one post, then for the pictures you create a separate table with the structure - id, path (path to the picture) and post_id (id of the post). Well, the best practice with pictures is https://laravel.com/docs/5.2/eloquent-relationship... . Let's say your users can change their avatar. You store photos for posts and for users in one place, but when saving a photo, specify the type (post/user).

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question