Right way for multiple Upload inputs #1709
Unanswered
artemklushin
asked this question in
Q&A
Replies: 3 comments 5 replies
-
My work example In EditScreen Upload::make('data.filesRu')
->maxFiles(1)
->groups('ru')
->title('Файл (рус)')
->vertical(),
Upload::make('data.filesEn')
->maxFiles(1)
->groups('en')
->title('Файл (англ)')
->vertical(),
Upload::make('data.filesZh')
->maxFiles(1)
->groups('zh')
->title('Файл (китай)')
->vertical(), In Eloquent model public function filesRu()
{
return $this->attachment('ru');
}
public function filesEn()
{
return $this->attachment('en');
}
public function filesZh()
{
return $this->attachment('zh');
} When I save model $model->attachment('ru')->syncWithoutDetaching($properties['filesRu']);
$model->attachment('en')->syncWithoutDetaching($properties['filesEn']);
$model->attachment('zh')->syncWithoutDetaching($properties['filesZh']); Is it right way? |
Beta Was this translation helpful? Give feedback.
4 replies
-
I am wondering the same thing. What is the correct way to define attachment relationships? Does the "attachmentable" table need to be set and what is the purpose of this? |
Beta Was this translation helpful? Give feedback.
1 reply
-
I finally got this working. (This might not be the best way.) First of all, make sure to use the Attachable trait in your model. I defined my Upload field like this:
And in my save handler:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello.
I want to load a file for each app language and return its depending on request language.
I read documentation, but can't understand how to set multiple Upload inputs.
What is right way for settings three Upload inputs on EditScreen?
Beta Was this translation helpful? Give feedback.
All reactions