You can add unlimited fields to your CRUD.
By default, we include auto-incremented
id field, also timestamps -
updated_at. They are not visible and you can't change them.
Every field you create has some Main Settings. Also, based on the field type, there can be a few Additional settings.
Let's look through Main Settings and what you can do here.
Simple dropdown, defining what field you want to create. We will talk about each of them later, but here's the list of options:
- Date picker
- Date and time picker
- Time picker
- BelongsTo Relationship
- BelongsToMany Relationship
- ENUM Select Dropdown
- Location Address
Field Key and Label
These two are related to each other.
Key defines everything related to field in the code: database name,
input name value etc. So it's important that the key is in English language, otherwise Laravel may not understand how to generate the code.
Label is automatically generated from Key field, and usually is the same, or really similar. But here you can have freedom to put any text you want - it will be visible "as is" in HTML/Blade files: as column title, label for input fields, request validation messages etc.
There are three options for validating the field:
- Required and Unique
These will affect both Blade templates with
required option in input fields, and also
app/Http/Requests files for validation rules.
Field Visibility: in list/show/create/edit
Here you can specify, where the field should be visible:
- In list: in the table of entries, as a column
In show: in
show.blade.phpview of Controller's
show()method, when viewing one particular entry
- In create/edit: in create or edit form respectively. Maybe you want to the field to be only editable when creating or editing entry.
A simple text which will be shown in the forms as helper explaining what the field is about. You can tell your users here about some validation rules, or typical values for the field, like "Only letters and numbers accepted".
Now, it's time to get to know each field type better.