D
D
Donald_Duck2018-06-28 09:48:11
Software design
Donald_Duck, 2018-06-28 09:48:11

Where to take out the logic for saving the file loaded through the form?

Hello! Where is the best place to put the logic for processing and saving the uploaded file through the form?
At the moment I'm considering 3 options:
1. Create a base controller and inherit from it.
2. Move to a trait.
3. Transfer to a separate class and work with it.
4. Your option...
In short, what will be the logic: creating a path (with checking if there is already such a file) along which the file will be saved, and actually saving the file itself request()->file('file')->storeAs(...). Perhaps something else will be added, for example, setting a disk for saving.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Antonio Solo, 2018-06-28
@solotony

If your file is some independent entity - 3.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question