Roshan Pal
Roshan Pal

Reputation: 7796

Dynamically creating form, table and model?

I need to build an application which will have an admin area where admin can create forms and assign validation rules. I can use either laravel or cakephp for this application. What is the best way to do this? Should I create tables and models separately for each admin created form or should I use a master table to store admin created form fields?

Upvotes: 0

Views: 1062

Answers (2)

matasoy
matasoy

Reputation: 696

I made a little system. In this system you choose your database and table, and select your field names, and choose field's type of form (text area, text, radio button groups, etc) and push create. You will have a bootstrap designed form and php insert code writed with medoo.

you can use this. create your database first and make form fomr automaticly. Copy code and paste to your admin pages. Here is the link

Its written in Turkish but you can solve it easyly ;)

Upvotes: 0

Paul Bele
Paul Bele

Reputation: 1534

I made something similar for custom fields in larvel.

You can create something like : for viewing and inputing you can create a FieldGenerator ( with different types like text/numbers/ selects , etc ) FieldGenerator also has a validator based on it's type ( for example numbers can only get valid data if there are numbers inputed )

A form has multiple fieldGenerators.

All data can be stored in 1 master table ( using json encoding ) or in different tables ( it all depends on how many fields there will be, how many forms there will be )

In my opinion, you can put them in 1 table, using json encoding

This isn't extremely hard to do using Laravel, let me know if you want further help

Upvotes: 1

Related Questions