A
A
Arman2019-09-04 10:48:34
Laravel
Arman, 2019-09-04 10:48:34

How do you work with forms in Laravel?

1. As you remember, there was something out of the box for working with forms, but then they threw it away?
It turns out by default that we work with forms on pure HTML (+blade)? Are you using any packages?
2. How to work correctly with CRUD with C and U , i.e. it is necessary to show the form twice and these are different views? Or do you throw the form into one view and drive there? Let's say in Yii Gii we create create.php, edit.php and _form.php by default, but Yii has form objects and it's more convenient to work from them, but who's like? bunch of if's $isCreateForm?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
R
Razgelday, 2019-09-04
@Razgelday

In general, with the development of Laravel, it is recommended to bring the entire front-end from Blade to Vue.js - and then create any forms in JS and send form data to the server via the API.
Here is a simple tutorial on Laracasts (eng) - https://laracasts.com/series/learn-vue-2-step-by-s...

S
Sanes, 2019-09-04
@Sanes

Two winds. Because content may vary.

A
Antonio Solo, 2019-09-04
@solotony

For laravel, I set laravelcollective/html . used only for forms.

A
Anton Anton, 2019-09-04
@Fragster

I do one, with create I pass new Model with update - the existing instance. But sometimes this approach is not quite suitable. Well, action can either be determined in the view by the filling of the key field, or also passed from the controller.

E
Eugene Wolf, 2019-09-04
@Wolfnsex

1. As you remember, there was something out of the box for working with forms, but then they threw it away?
So it is, they threw out such tails as unnecessary in the main framework. In the sense that this tail also needs to be supported ...
It turns out by default that we work with forms on pure HTML (+blade)? Are you using any packages?
You can do this, you can use the shapes that you cut out , you can use the symfony option , you can also look for other options here .
2. How to work correctly with CRUD with C and U, i.e. it is necessary to show the form twice and these are different views? Or do you throw the form into one view and drive there?
Everything is individual. In general, with simple options - it is not necessary to create different shape files, with "C" you can create the same shape as with "U", passing an empty model there.

N
Nikolay Starkov, 2019-09-04
@phpnick

I work with forms in lara using pure html+blade.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question