auto() form()
Build a form from the columns of a DB table and fill it with one row: the field kind follows the column type.
form()->auto($table = '', $id = '', $params = [])Опції
| Опція | Значення |
|---|---|
$table, $id | Table and row id; id becomes an info row, login / email / phone / active their fields, enum / set radios, dates datetime_select(), text textarea(), numbers number() / float(). |
db, links_add | Database object; a string added to the form links. |
Приклад
Цей приклад читає базу даних: він виконується лише в документації адмінки.
Код
return form()->auto(db('static_pages'), 1);Примітки
- Without a table, a form made from an SQL string shows each value as a container row.
- A Save and back button is added. Handy for admin prototypes; a real form names its fields.
Див. також: table/auto