You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: 7.x-dev/crud-fields.md
+14-13Lines changed: 14 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -325,7 +325,7 @@ CRUD::field([ // Checklist
325
325
'pivot' => true,
326
326
'show_select_all' => true, // default false
327
327
// 'number_of_columns' => 3,
328
-
328
+
329
329
]);
330
330
```
331
331
@@ -874,7 +874,7 @@ CRUD::field([
874
874
875
875
#### Uploading files with summernote
876
876
877
-
Summernote saves images as base64 encoded strings in the database. If you want to save them as files on the server, you can use the [Summernote Uploader](https://backpackforlaravel.com/docs/7.x/crud-uploaders). Please note that the Summernote Uploader is part of the `backpack/pro` package.
877
+
Summernote saves images as base64 encoded strings in the database. If you want to save them as files on the server, you can use the [Summernote Uploader](https://backpackforlaravel.com/docs/7.x/crud-uploaders). Please note that the Summernote Uploader is part of the `backpack/pro` package.
878
878
Input preview:
879
879
880
880

@@ -1153,22 +1153,22 @@ CRUD::field([ // Address google
1153
1153
]);
1154
1154
```
1155
1155
1156
-
Using Google Places API is dependent on using an API Key. Please [get an API key](https://console.cloud.google.com/apis/credentials) - you do have to configure billing, but you qualify for $200/mo free usage, which covers most use cases. Then copy-paste that key as your ```services.google_places.key``` value.
1156
+
Using Google Places API is dependent on using an API Key. Please [get an API key](https://console.cloud.google.com/apis/credentials) - you do have to configure billing, but you qualify for $200/mo free usage, which covers most use cases. Then copy-paste that key as your ```services.google_places.key``` value.
1157
1157
1158
1158
**IMPORTANT NOTE**: Your key needs access to the following APIS:
1159
1159
- Maps JavaScript API;
1160
1160
- Places API;
1161
1161
- Geocoding API.
1162
1162
1163
-
While developing you can use an "unrestricted key" (no restrictions for where the key is used), but for production you should use a separate key, and **MAKE SURE** you restrict the usage of that key to your own domain.
1163
+
While developing you can use an "unrestricted key" (no restrictions for where the key is used), but for production you should use a separate key, and **MAKE SURE** you restrict the usage of that key to your own domain.
1164
1164
1165
1165
So inside your ```config/services.php``` please add the items below:
1166
1166
```php
1167
1167
'google_places' => [
1168
1168
'key' => 'the-key-you-got-from-google-places'
1169
1169
],
1170
1170
```
1171
-
Alternatively you can set the key in your field definition, but we do **not recommend** it:
1171
+
Alternatively you can set the key in your field definition, but we do **not recommend** it:
1172
1172
```php
1173
1173
[
1174
1174
'name' => 'google_field',
@@ -1445,7 +1445,7 @@ Using Google Places API is dependent on using an API Key. Please [get an API key
1445
1445
- Places API;
1446
1446
- Geocoding API.
1447
1447
1448
-
While developing you can use an "unrestricted key" (no restrictions for where the key is used), but for production you should use a separate key, and **MAKE SURE** you restrict the usage of that key to your own domain.
1448
+
While developing you can use an "unrestricted key" (no restrictions for where the key is used), but for production you should use a separate key, and **MAKE SURE** you restrict the usage of that key to your own domain.
1449
1449
1450
1450
**How to save in multiple inputs?**
1451
1451
@@ -1791,7 +1791,7 @@ CRUD::field([
1791
1791
1792
1792
By default Backpack does not allow you to select the same pivot twice. If you want to allow the selection of the same pivot more than once you should take some setup steps before. Follow along with the steps below:
1793
1793
1794
-
**1)** Make sure your pivot table has a unique key, usually an auto-increment id. If you don't have one, you can add it with a migration.
1794
+
**1)** Make sure your pivot table has a unique key, usually an auto-increment id. If you don't have one, you can add it with a migration.
1795
1795
1796
1796
**2)** Add the `id` to your `->withPivot()` fields on your relation. Eg:
1797
1797
```php
@@ -1816,7 +1816,7 @@ CRUD::field([
1816
1816
'name' => 'companies',
1817
1817
'type' => 'relationship',
1818
1818
'allow_duplicate_pivots' => true,
1819
-
'subfields' => // your subfields (do not add `id` as a subfield. That's done automatically by Backpack).
1819
+
'subfields' => // your subfields (do not add `id` as a subfield. That's done automatically by Backpack).
// 'allows_multiple' => true, // OPTIONAL; needs you to cast this to array in your model;
2183
-
// 'sortable' => true, // requires the field to accept multiple values, and allow the selected options to be sorted.
2183
+
// 'sortable' => true, // requires the field to accept multiple values, and allow the selected options to be sorted;
2184
+
// 'tagging' => true, // allow users to type and create new options.
2184
2185
]);
2185
2186
```
2186
2187
@@ -2368,7 +2369,7 @@ CRUD::field([
2368
2369
'minimum_input_length' => 2, // minimum characters to type before querying results
2369
2370
'multiple' => true, // allow multiple selections
2370
2371
'include_all_form_fields' => false, // only send the current field through AJAX (for a smaller payload if you're not using multiple chained select2s)
2371
-
2372
+
2372
2373
// OPTIONAL - if the response is a list of objects (and not a simple array)
2373
2374
'attribute' => 'title', // attribute to show in the select2
2374
2375
'attributes_to_store' => ['id', 'title'], // attributes to store in the database
@@ -2419,7 +2420,7 @@ public function fetchAirports()
2419
2420
2420
2421
#### Storing only one the id in the database
2421
2422
2422
-
A very common use case you may have is to store only the id of the selected item in the database instead of a `json` string. For those cases you can achieve that by setting the `attributes_to_store` attribute to an array with only one item, the id of the selected item and do a little trick with the model events to store the id you want, and to give the field that id in a way it understands.
2423
+
A very common use case you may have is to store only the id of the selected item in the database instead of a `json` string. For those cases you can achieve that by setting the `attributes_to_store` attribute to an array with only one item, the id of the selected item and do a little trick with the model events to store the id you want, and to give the field that id in a way it understands.
2423
2424
2424
2425
```php
2425
2426
@@ -2428,7 +2429,7 @@ CRUD::field([
2428
2429
'type' => 'select2_json_from_api',
2429
2430
'name' => 'airport_id', // dont make your column json if not storing json on it!
Track the value of a different text input and turn it into a valid URL segment (aka. slug), as you type, using Javascript. Under the hood it uses [slugify](https://github.com/simov/slugify/blob/master/README.md) to generate the slug with some sensible defaults.
2449
+
Track the value of a different text input and turn it into a valid URL segment (aka. slug), as you type, using Javascript. Under the hood it uses [slugify](https://github.com/simov/slugify/blob/master/README.md) to generate the slug with some sensible defaults.
0 commit comments