This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

alexwenzel
alexwenzel

Hi all,

I am building an application where a single entity has a gallery with multiple images inside. Looks like this:

Entity

  • id
  • name
  • [...]
  • gallery[]
    • image
    • image
    • [...]

I already have had a look and did some research, but I want to ask you for ideas, how to realise this.

How do i add multiple images in the backend form?

Thanks in advance.

amdad
amdad

First of all, you must add relation to model. Check $attachMany https://octobercms.com/docs/database/attachments#file-attachments

And configure form widget: https://octobercms.com/docs/backend/forms#widget-fileupload

Use Builder Plugin for help to configure.

alexwenzel
alexwenzel

Thanks a lot. Seems to work. I expected to create a database table for the relations and so on.

But it was working out of the box. I just did the following steps:

  • defining a relation for my gallery images
  • adding a fileupload widget for my backend form

thanks a lot :)

amdad
amdad

Yea, it's October breeze!

1-4 of 4

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.