{"action":"created","issue":{"url":"https://api.github.com/repos/Laravel-Backpack/CRUD/issues/189","repository_url":"https://api.github.com/repos/Laravel-Backpack/CRUD","labels_url":"https://api.github.com/repos/Laravel-Backpack/CRUD/issues/189/labels{/name}","comments_url":"https://api.github.com/repos/Laravel-Backpack/CRUD/issues/189/comments","events_url":"https://api.github.com/repos/Laravel-Backpack/CRUD/issues/189/events","html_url":"https://github.com/Laravel-Backpack/CRUD/pull/189","id":183510386,"number":189,"title":"[Feature] Input Address Form with Google API","user":{"login":"M4rk3tt0","id":7859305,"avatar_url":"https://avatars.githubusercontent.com/u/7859305?v=3","gravatar_id":"","url":"https://api.github.com/users/M4rk3tt0","html_url":"https://github.com/M4rk3tt0","followers_url":"https://api.github.com/users/M4rk3tt0/followers","following_url":"https://api.github.com/users/M4rk3tt0/following{/other_user}","gists_url":"https://api.github.com/users/M4rk3tt0/gists{/gist_id}","starred_url":"https://api.github.com/users/M4rk3tt0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/M4rk3tt0/subscriptions","organizations_url":"https://api.github.com/users/M4rk3tt0/orgs","repos_url":"https://api.github.com/users/M4rk3tt0/repos","events_url":"https://api.github.com/users/M4rk3tt0/events{/privacy}","received_events_url":"https://api.github.com/users/M4rk3tt0/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-10-17T19:51:28Z","updated_at":"2016-10-25T12:28:49Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Laravel-Backpack/CRUD/pulls/189","html_url":"https://github.com/Laravel-Backpack/CRUD/pull/189","diff_url":"https://github.com/Laravel-Backpack/CRUD/pull/189.diff","patch_url":"https://github.com/Laravel-Backpack/CRUD/pull/189.patch"},"body":"**Summary**\r\n\r\nCreates an _**address form**_ composed by:\r\n- an autocomplete field based on Google Places API \r\n- several other fields, choosen by the user, that will contain the components of the address\r\n\r\nThe fields will be filled automatically \r\n\r\n**Preview**\r\n\r\n![address](https://cloud.githubusercontent.com/assets/7859305/19452080/e1b7d21c-94af-11e6-9bf0-9550ff914011.gif)\r\n\r\n**Usage**\r\n\r\n```php\r\n$this->crud->addField([\r\n            'name'  \t\t\t=> 'address',\r\n            'label' \t\t\t=> 'Indirizzo',\r\n            'type'  \t\t\t=> 'address_form_google',\r\n            'google_api_key'\t=> env('GOOGLE_API_KEY'),\r\n            \r\n            'components' =>  [\r\n                'COMPONENT' => [   \r\n                    'name'  => 'address_line_1',\r\n                    'label' => 'Via',\r\n                    'type'  => 'long_name', // Optional\r\n                ],\r\n                // Other components\r\n            ],\r\n        ]);\r\n```\r\nThis field needs a Google API Key that can be retrived [here](https://developers.google.com/places/web-service/get-api-key)\r\n\r\nThe components that can be used are:\r\n\r\n- 'route'\r\n- 'street_number'\r\n- 'postal_code'\r\n- 'locality'\r\n- 'administrative_area_level_1'\r\n- 'administrative_area_level_2' \r\n- 'country'\r\n\r\nso a complete field would look like this:\r\n\r\n```php\r\n$this->crud->addField([\r\n            'name'  \t\t\t=> 'address',\r\n            'label' \t\t\t=> 'Indirizzo',\r\n            'type'  \t\t\t=> 'address_form_google',\r\n            'google_api_key'\t=> env('GOOGLE_API_KEY'),\r\n            \r\n            'components' =>  [\r\n                'route' => [   \r\n                    'name'  => 'address_line_1',\r\n                    'label' => 'Via',\r\n                    'type'  => 'long_name',\r\n                ],\r\n                'street_number' => [   \r\n                    'name'  => 'address_line_2',\r\n                    'label' => 'Civico',\r\n                    'type'  => 'short_name',\r\n                ],\r\n                'postal_code' => [   \r\n                    'name'  => 'postal_code',\r\n                    'label' => 'CAP',\r\n                    'type'  => 'short_name',\r\n                ],\r\n                'locality' => [  \r\n                    'name'  => 'city',\r\n                    'label' => 'Città',\r\n                    'type'  => 'long_name',\r\n                ],    \r\n                'administrative_area_level_1' => [    \r\n                    'name'  => 'region',\r\n                    'label' => 'Regione',\r\n                    'type'  => 'long_name',\r\n                ],\r\n                'administrative_area_level_2' => [   \r\n                    'name'  => 'province',\r\n                    'label' => 'Provincia',\r\n                    'type'  => 'short_name',\r\n                ],\r\n                'country' => [  \r\n                    'name'  => 'country',\r\n                    'label' => 'Nazione',\r\n                    'type'  => 'short_name',\r\n                ],\r\n            ],\r\n        ]);\r\n```\r\n\r\nthe 'type' attribute is optional and can be set to 'short_name' or 'long_name'. \r\nThe default value is 'long_name'.\r\n\r\n**_Each component needs a column in the table_**. \r\nThe autocomplete field is not stored so it doesn't need a column in the table.\r\n\r\nA complete migration would look like this:\r\n\r\n```php\r\npublic function up()\r\n    {\r\n        Schema::create('addresses', function (Blueprint $table) {\r\n            $table->increments('id');\r\n            $table->string('address_line_1');\r\n            $table->string('address_line_2');\r\n            $table->string('city');\r\n            $table->string('region');\r\n            $table->string('province');\r\n            $table->string('postal_code');\r\n            $table->string('country');\r\n            $table->timestamps();\r\n        });\r\n    }\r\n```\r\nAll the fields can be **validated** with their **own** rules like every standard field."},"comment":{"url":"https://api.github.com/repos/Laravel-Backpack/CRUD/issues/comments/256020739","html_url":"https://github.com/Laravel-Backpack/CRUD/pull/189#issuecomment-256020739","issue_url":"https://api.github.com/repos/Laravel-Backpack/CRUD/issues/189","id":256020739,"user":{"login":"elraghifary","id":10007315,"avatar_url":"https://avatars.githubusercontent.com/u/10007315?v=3","gravatar_id":"","url":"https://api.github.com/users/elraghifary","html_url":"https://github.com/elraghifary","followers_url":"https://api.github.com/users/elraghifary/followers","following_url":"https://api.github.com/users/elraghifary/following{/other_user}","gists_url":"https://api.github.com/users/elraghifary/gists{/gist_id}","starred_url":"https://api.github.com/users/elraghifary/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elraghifary/subscriptions","organizations_url":"https://api.github.com/users/elraghifary/orgs","repos_url":"https://api.github.com/users/elraghifary/repos","events_url":"https://api.github.com/users/elraghifary/events{/privacy}","received_events_url":"https://api.github.com/users/elraghifary/received_events","type":"User","site_admin":false},"created_at":"2016-10-25T12:28:49Z","updated_at":"2016-10-25T12:28:49Z","body":"Is this possible to get location from our location or device like using HTML5 instead typing specific address? Would be useful if that happens. :)"}}
{"actor":{"display_login":"elraghifary"}}