jeudi 1 septembre 2016

What is the best practice to work with forms in Laravel?

I'm writing my first Laravel app and i'm confused a little about how laravel works with forms.

In the head of my app - image generation. I need help with app logic and maybe some links to docs that will help me understand how to write good code.
I call it scene manager. Manager have 3 main functions - create, edit, delete scene. I have ugly form to create scene. In this form i have to collect info 3 diff layers of photo (like mask, effects, etc) - width, height, control points where top image will be placed. Kinda tricky a little. Here is an image: form

I created a viewer for this form, route takes me there .. and if i've got right - i have to submit this form to the SceneController. Where i will receive data, save image to the server and write data to DB. Than i must call outside php script to do some magic and return me an image - that i have to show on result page.

I discovered that i can use FORM method:
// with arguments:

'url' => 'generate', 'method'=>'POST', 'files'=>true

but what is the best practice to collect, send and receive data? Object / array or what?

Will be glad to see your ideas, sources, links. I'm really confused about that. Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire