{"action":"created","issue":{"url":"https://api.github.com/repos/Silvanite/novafieldcheckboxes/issues/7","repository_url":"https://api.github.com/repos/Silvanite/novafieldcheckboxes","labels_url":"https://api.github.com/repos/Silvanite/novafieldcheckboxes/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/Silvanite/novafieldcheckboxes/issues/7/comments","events_url":"https://api.github.com/repos/Silvanite/novafieldcheckboxes/issues/7/events","html_url":"https://github.com/Silvanite/novafieldcheckboxes/issues/7","id":369719154,"node_id":"MDU6SXNzdWUzNjk3MTkxNTQ=","number":7,"title":"Write Checkbox Data to DB","user":{"login":"randyrankin","id":13204196,"node_id":"MDQ6VXNlcjEzMjA0MTk2","avatar_url":"https://avatars1.githubusercontent.com/u/13204196?v=4","gravatar_id":"","url":"https://api.github.com/users/randyrankin","html_url":"https://github.com/randyrankin","followers_url":"https://api.github.com/users/randyrankin/followers","following_url":"https://api.github.com/users/randyrankin/following{/other_user}","gists_url":"https://api.github.com/users/randyrankin/gists{/gist_id}","starred_url":"https://api.github.com/users/randyrankin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/randyrankin/subscriptions","organizations_url":"https://api.github.com/users/randyrankin/orgs","repos_url":"https://api.github.com/users/randyrankin/repos","events_url":"https://api.github.com/users/randyrankin/events{/privacy}","received_events_url":"https://api.github.com/users/randyrankin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-10-12T21:38:25Z","updated_at":"2018-11-11T16:46:15Z","closed_at":null,"author_association":"NONE","body":"I have the following tables:\r\n\r\n**users**\r\n\r\n- id\r\n- name\r\n\r\n**meetings**\r\n\r\n- id\r\n- topic\r\n\r\n**meeting_user**\r\n\r\n- meeting_id\r\n- user_id\r\n\r\nI have also created the following in the User and Meeting models:\r\n\r\n```\r\nclass User extends Model\r\n{\r\n    /**\r\n     * The meetings that belong to the user\r\n     */\r\n    public function meetings()\r\n    {\r\n        return $this->belongsToMany('App\\Meeting');\r\n    }\r\n}\r\n```\r\nand \r\n\r\n```\r\n\r\nclass Meeting extends Model\r\n{\r\n    /**\r\n     * The users that belong to the meeting\r\n     */\r\n    public function users()\r\n    {\r\n        return $this->belongsToMany('App\\User');\r\n    }\r\n}\r\n```\r\nIn my Nova Meeting resource, I have the following:\r\n\r\n```\r\nreturn [\r\n...\r\nCheckboxes::make('Users')->options(collect(\\App\\User::all())\r\n                ->mapWithKeys(function ($user) {\r\n                    return [\r\n                        $user->id => $user->name,\r\n                    ];\r\n                })\r\n                ->sort()\r\n                ->toArray()),\r\n...\r\n]\r\n```\r\nThis renders user checkboxes on the meetings form (beautifully, btw), but I don't understand how to write the data to the meeting_user table. Can you guide me?"},"comment":{"url":"https://api.github.com/repos/Silvanite/novafieldcheckboxes/issues/comments/437685353","html_url":"https://github.com/Silvanite/novafieldcheckboxes/issues/7#issuecomment-437685353","issue_url":"https://api.github.com/repos/Silvanite/novafieldcheckboxes/issues/7","id":437685353,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzY4NTM1Mw==","user":{"login":"wa7eedem","id":1952412,"node_id":"MDQ6VXNlcjE5NTI0MTI=","avatar_url":"https://avatars1.githubusercontent.com/u/1952412?v=4","gravatar_id":"","url":"https://api.github.com/users/wa7eedem","html_url":"https://github.com/wa7eedem","followers_url":"https://api.github.com/users/wa7eedem/followers","following_url":"https://api.github.com/users/wa7eedem/following{/other_user}","gists_url":"https://api.github.com/users/wa7eedem/gists{/gist_id}","starred_url":"https://api.github.com/users/wa7eedem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wa7eedem/subscriptions","organizations_url":"https://api.github.com/users/wa7eedem/orgs","repos_url":"https://api.github.com/users/wa7eedem/repos","events_url":"https://api.github.com/users/wa7eedem/events{/privacy}","received_events_url":"https://api.github.com/users/wa7eedem/received_events","type":"User","site_admin":false},"created_at":"2018-11-11T16:46:15Z","updated_at":"2018-11-11T16:46:15Z","author_association":"NONE","body":"yes , actually after doing the `text field` and add the `cast to array` ,\r\nthe only way to make it works for me is be disabling the `castValueToType`\r\n\r\nI saw @m2de added this to [fix some issues](https://github.com/Silvanite/novafieldcheckboxes/issues/1) , and its cause me another one , I think its depend on how we will handling the stored data \r\nas `[1,2,3]` or `[\"1\",\"2\",\"3\"]`\r\n\r\n\r\n@m2de could this be an optional ? like : \r\n\r\n`Checkboxes::make('apps')->options($apps)->withCastValueToType()`\r\n\r\n"}}
{"actor":{"display_login":"wa7eedem"}}