Answer the question
In order to leave comments, you need to log in
How to make applications with forms and CRUD operations on Laravel?
I often have to develop typical web applications with many forms and CRUD operations. For example, any custom CRM or accounting systems. Usually these are several dozen forms, with hundreds of different fields and dozens of tables. Each form is associated with one or more tables in the database.
Laravel tutorials usually write about the same thing. For each model, you need to: create a migration, make a seeder, create a model, create a controller with the necessary operations, lay out a form with fields, do validation (perhaps a separate request-class in turn), register routes, make tests .. etc. Those. all this is spread over different files, classes.
The most difficult thing is that with any change in the set of fields, all this constantly has to be edited in different places. And with the active development and development of the project, all this changes regularly.
Of course, this is not a problem when creating a simple blog, as is usually seen in the examples. But in a real, not the simplest application, if this is done manually for each model, it will take a lot of time and lead to constant errors. Generally very inefficient.
How should such problems be dealt with?
Previously, I used my bicycles, which allowed me to declaratively describe all fields, forms, relationships and operations in a single place. When the requirements for the application changed, it was enough to make corrections in one place, and everything else (models, controllers, form templates...) automatically picked up the new configuration.
What is the correct path to use in Laravel?
Answer the question
In order to leave comments, you need to log in
The correct path is not tied to a framework, it is worth creating some kind of logical core (core module) and creating implementation modules based on it. You can write a private Laravel package that will combine all the logic of code generation and configuration in a standardized way
Those. all this is spread over different files, classes.
The most difficult thing is that with any change in the set of fields, all this constantly has to be edited in different places.
if you do it manually for each model, it will take a lot of time
and lead to permanent errors
What is the correct path to use in Laravel?
- Customization of default stubs
- https://github.com/laravel-shift/blueprint
- Custom commands for artisan that automate many steps
- Custom packages that take on heavy lifting and provide a convenient API for work
You are a programmer. A framework is not a rigid framework in which you are clamped. It's a flexible framework on which you build exactly what you need. So, whichever is more convenient for you.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question