Skip to content

Commit

Permalink
Add Country Code
Browse files Browse the repository at this point in the history
  • Loading branch information
hnassr committed Sep 2, 2018
1 parent b33bac3 commit 6043129
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ composer require hnassr/nova-places
```

```php
['country', 'county', 'administrative', 'city', 'full'] // Available Fileds
['country', 'county', 'administrative', 'city', 'full', 'countryCode'] // Available Fileds
```

```php
Places::make('Place', 'place')
->locale('de') // default locale is en
->indexField('city') // what to show in resource index page
->showFields(['country', 'county', 'administrative', 'city', 'full']), // what to show in resource preview page
```
Expand Down
2 changes: 1 addition & 1 deletion dist/js/field.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions resources/js/components/DetailField.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<template>
<panel-item :field="field">
<div class="" v-if="place" slot="value">
<div class="flex" v-if="field.show_fields.indexOf('countryCode') > -1">
<div class="w-1/6 py-4">
<h4 class="font-normal text-80">Country Code</h4>
</div>
<div class="w-3/4 py-4">
<p class="text-90">{{ place.countryCode }}</p>
</div>
</div>
<div class="flex" v-if="field.show_fields.indexOf('country') > -1">
<div class="w-1/6 py-4">
<h4 class="font-normal text-80">Country</h4>
Expand Down
3 changes: 2 additions & 1 deletion resources/js/components/IndexField.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
'county': 'county',
'administrative': 'administrative',
'city': 'name',
'full': 'value'
'full': 'value',
'countryCode': 'countryCode',
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions src/Places.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Places extends Field

/**
* @param array $fields
* @options=["country", "county", "administrative", "city", "full"]
* @options=["country", "county", "administrative", "city", "full", "countryCode"]
* @return Places
*/
public function showFields(array $fields)
Expand All @@ -25,7 +25,7 @@ public function showFields(array $fields)

/**
* @param string $filed
* @options=["country", "county", "administrative", "city", "full"]
* @options=["country", "county", "administrative", "city", "full", "countryCode"]
* @return Places
*/
public function indexField(string $filed)
Expand Down

0 comments on commit 6043129

Please sign in to comment.