{"action":"created","issue":{"url":"https://api.github.com/repos/whitecube/nova-flexible-content/issues/11","repository_url":"https://api.github.com/repos/whitecube/nova-flexible-content","labels_url":"https://api.github.com/repos/whitecube/nova-flexible-content/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/whitecube/nova-flexible-content/issues/11/comments","events_url":"https://api.github.com/repos/whitecube/nova-flexible-content/issues/11/events","html_url":"https://github.com/whitecube/nova-flexible-content/issues/11","id":419977036,"node_id":"MDU6SXNzdWU0MTk5NzcwMzY=","number":11,"title":"Support for belongsTo fields","user":{"login":"BenySLO","id":19827084,"node_id":"MDQ6VXNlcjE5ODI3MDg0","avatar_url":"https://avatars0.githubusercontent.com/u/19827084?v=4","gravatar_id":"","url":"https://api.github.com/users/BenySLO","html_url":"https://github.com/BenySLO","followers_url":"https://api.github.com/users/BenySLO/followers","following_url":"https://api.github.com/users/BenySLO/following{/other_user}","gists_url":"https://api.github.com/users/BenySLO/gists{/gist_id}","starred_url":"https://api.github.com/users/BenySLO/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BenySLO/subscriptions","organizations_url":"https://api.github.com/users/BenySLO/orgs","repos_url":"https://api.github.com/users/BenySLO/repos","events_url":"https://api.github.com/users/BenySLO/events{/privacy}","received_events_url":"https://api.github.com/users/BenySLO/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2019-03-12T13:09:16Z","updated_at":"2019-03-12T14:26:23Z","closed_at":null,"author_association":"NONE","body":"Adding \"belongsTo\" field into the \"addLayout\" triggers error \"Call to a member function xy() on array\"\r\nIn the documentation it is written than all Laravel Nova fields are supported. \r\n\r\nWe tried adding BelongsTo fields like this:\r\n`Flexible::make('flex_data')->addLayout('Simple content section', 'test', [BelongsTo::make('xy'),]),`"},"comment":{"url":"https://api.github.com/repos/whitecube/nova-flexible-content/issues/comments/472022929","html_url":"https://github.com/whitecube/nova-flexible-content/issues/11#issuecomment-472022929","issue_url":"https://api.github.com/repos/whitecube/nova-flexible-content/issues/11","id":472022929,"node_id":"MDEyOklzc3VlQ29tbWVudDQ3MjAyMjkyOQ==","user":{"login":"Nyratas","id":5635557,"node_id":"MDQ6VXNlcjU2MzU1NTc=","avatar_url":"https://avatars3.githubusercontent.com/u/5635557?v=4","gravatar_id":"","url":"https://api.github.com/users/Nyratas","html_url":"https://github.com/Nyratas","followers_url":"https://api.github.com/users/Nyratas/followers","following_url":"https://api.github.com/users/Nyratas/following{/other_user}","gists_url":"https://api.github.com/users/Nyratas/gists{/gist_id}","starred_url":"https://api.github.com/users/Nyratas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nyratas/subscriptions","organizations_url":"https://api.github.com/users/Nyratas/orgs","repos_url":"https://api.github.com/users/Nyratas/repos","events_url":"https://api.github.com/users/Nyratas/events{/privacy}","received_events_url":"https://api.github.com/users/Nyratas/received_events","type":"User","site_admin":false},"created_at":"2019-03-12T14:26:22Z","updated_at":"2019-03-12T14:26:22Z","author_association":"MEMBER","body":"Hi @BenySLO,\r\n\r\nRelationship fields are quite different than most of the existing \"content\" fields out there. That's also why they are treated separately from all the other fields in the [official Nova Documentation](https://nova.laravel.com/docs/2.0/resources/relationships.html).\r\n\r\nThe requested \"fields\" need existing relationships on the underlying models, but since the fields inside a Flexible Field refer to a \"Field group\" instead of the resource, this relationship does not exist.\r\n\r\nIt is however possible to create a custom `BelongsTo` behavior using [Layout Classes](https://whitecube.github.io/nova-flexible-content/#/?id=custom-layout-classes). A more explicit example is provided as a response to #5."}}
{"actor":{"display_login":"Nyratas"}}