{"action":"created","issue":{"url":"https://api.github.com/repos/grimzy/laravel-mysql-spatial/issues/22","repository_url":"https://api.github.com/repos/grimzy/laravel-mysql-spatial","labels_url":"https://api.github.com/repos/grimzy/laravel-mysql-spatial/issues/22/labels{/name}","comments_url":"https://api.github.com/repos/grimzy/laravel-mysql-spatial/issues/22/comments","events_url":"https://api.github.com/repos/grimzy/laravel-mysql-spatial/issues/22/events","html_url":"https://github.com/grimzy/laravel-mysql-spatial/issues/22","id":261510564,"number":22,"title":"MultiLineString::__construct() must be of the type array, object given","user":{"login":"bretterer","id":1906920,"avatar_url":"https://avatars2.githubusercontent.com/u/1906920?v=4","gravatar_id":"","url":"https://api.github.com/users/bretterer","html_url":"https://github.com/bretterer","followers_url":"https://api.github.com/users/bretterer/followers","following_url":"https://api.github.com/users/bretterer/following{/other_user}","gists_url":"https://api.github.com/users/bretterer/gists{/gist_id}","starred_url":"https://api.github.com/users/bretterer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bretterer/subscriptions","organizations_url":"https://api.github.com/users/bretterer/orgs","repos_url":"https://api.github.com/users/bretterer/repos","events_url":"https://api.github.com/users/bretterer/events{/privacy}","received_events_url":"https://api.github.com/users/bretterer/received_events","type":"User","site_admin":false},"labels":[{"id":552135489,"url":"https://api.github.com/repos/grimzy/laravel-mysql-spatial/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-09-29T01:58:55Z","updated_at":"2017-09-30T06:27:25Z","closed_at":null,"author_association":"NONE","body":"I am trying to use this package to store polygons in my database.  When I set up new points for each point of my polygon and use them to create a LineString to save as a Polygon on my model, I am getting an error (title of issue)\r\n\r\nThe output of Collection is shown below along with the code to generate the collection.\r\n\r\nI have added `use SpatialTrait;` and `protected $spatialFields = ['polygon'];` to my model.\r\n\r\nI use the generated `$polygons` variable in a relational model `save()` method.\r\n\r\nI have also set up the migration to use your Blueprint methods, even though Laravel now supports these fields.\r\n\r\nCode:\r\n\r\n```php\r\n$coords = explode(' ', $polygon);\r\n                $tempCoords = [];\r\n                foreach($coords as $coord) {\r\n                    list($lat, $lon) = explode(',', $coord);\r\n                    $tempCoords[] = new Point($lat, $lon);\r\n                }\r\n\r\n                $collection = new LineString($tempCoords);\r\n\r\n                $polygons[] = new MyModel([\r\n                    'polygon' => new Polygon($collection)\r\n                ]);\r\n```\r\n\r\nDump of $collection;\r\n\r\n```php\r\nGrimzy\\LaravelMysqlSpatial\\Types\\LineString {#764\r\n  #points: array:7 [\r\n    0 => Grimzy\\LaravelMysqlSpatial\\Types\\Point {#757\r\n      #lat: 34.39\r\n      #lng: -98.36\r\n    }\r\n    1 => Grimzy\\LaravelMysqlSpatial\\Types\\Point {#758\r\n      #lat: 34.51\r\n      #lng: -98.46\r\n    }\r\n    2 => Grimzy\\LaravelMysqlSpatial\\Types\\Point {#759\r\n      #lat: 34.51\r\n      #lng: -98.31\r\n    }\r\n    3 => Grimzy\\LaravelMysqlSpatial\\Types\\Point {#760\r\n      #lat: 34.4\r\n      #lng: -98.23\r\n    }\r\n    4 => Grimzy\\LaravelMysqlSpatial\\Types\\Point {#761\r\n      #lat: 34.21\r\n      #lng: -98.23\r\n    }\r\n    5 => Grimzy\\LaravelMysqlSpatial\\Types\\Point {#762\r\n      #lat: 34.22\r\n      #lng: -98.37\r\n    }\r\n    6 => Grimzy\\LaravelMysqlSpatial\\Types\\Point {#763\r\n      #lat: 34.39\r\n      #lng: -98.36\r\n    }\r\n  ]\r\n}\r\n\r\n```"},"comment":{"url":"https://api.github.com/repos/grimzy/laravel-mysql-spatial/issues/comments/333287614","html_url":"https://github.com/grimzy/laravel-mysql-spatial/issues/22#issuecomment-333287614","issue_url":"https://api.github.com/repos/grimzy/laravel-mysql-spatial/issues/22","id":333287614,"user":{"login":"grimzy","id":1837678,"avatar_url":"https://avatars0.githubusercontent.com/u/1837678?v=4","gravatar_id":"","url":"https://api.github.com/users/grimzy","html_url":"https://github.com/grimzy","followers_url":"https://api.github.com/users/grimzy/followers","following_url":"https://api.github.com/users/grimzy/following{/other_user}","gists_url":"https://api.github.com/users/grimzy/gists{/gist_id}","starred_url":"https://api.github.com/users/grimzy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/grimzy/subscriptions","organizations_url":"https://api.github.com/users/grimzy/orgs","repos_url":"https://api.github.com/users/grimzy/repos","events_url":"https://api.github.com/users/grimzy/events{/privacy}","received_events_url":"https://api.github.com/users/grimzy/received_events","type":"User","site_admin":false},"created_at":"2017-09-30T06:27:25Z","updated_at":"2017-09-30T06:27:25Z","author_association":"OWNER","body":"Duplicate of #7"}}
{"actor":{"display_login":"grimzy"}}