{"action":"created","issue":{"url":"https://api.github.com/repos/dimsav/laravel-translatable/issues/171","repository_url":"https://api.github.com/repos/dimsav/laravel-translatable","labels_url":"https://api.github.com/repos/dimsav/laravel-translatable/issues/171/labels{/name}","comments_url":"https://api.github.com/repos/dimsav/laravel-translatable/issues/171/comments","events_url":"https://api.github.com/repos/dimsav/laravel-translatable/issues/171/events","html_url":"https://github.com/dimsav/laravel-translatable/issues/171","id":113040197,"number":171,"title":"Fall back to default locale if the translation is null","user":{"login":"rigor789","id":879060,"avatar_url":"https://avatars.githubusercontent.com/u/879060?v=3","gravatar_id":"","url":"https://api.github.com/users/rigor789","html_url":"https://github.com/rigor789","followers_url":"https://api.github.com/users/rigor789/followers","following_url":"https://api.github.com/users/rigor789/following{/other_user}","gists_url":"https://api.github.com/users/rigor789/gists{/gist_id}","starred_url":"https://api.github.com/users/rigor789/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rigor789/subscriptions","organizations_url":"https://api.github.com/users/rigor789/orgs","repos_url":"https://api.github.com/users/rigor789/repos","events_url":"https://api.github.com/users/rigor789/events{/privacy}","received_events_url":"https://api.github.com/users/rigor789/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dimsav/laravel-translatable/labels/feature","name":"feature","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2015-10-23T15:13:48Z","updated_at":"2016-10-07T04:17:21Z","closed_at":null,"body":"Hey, I'm not sure if It's there, and I totally missed it, but I'm trying to translate properties, and if no translation is given `NULL` is saved to the db. When retrieving properties, the `NULL` properties don't fall back to the default locale, and just display blank!\r\n\r\nI could possibly create a helper for\r\n```php\r\n$model->property ?: $model->translate($default_locale)->property;\r\n```\r\nFor example\r\n```php\r\n$model->translateOrDefault($current_locale)->property;\r\n```\r\nWill check if a translation exists, and if it does, it will return it, but if the property is null, it will not fall back to the default!\r\n\r\nHave I missed something, or is this the intended behaviour?\r\n"},"comment":{"url":"https://api.github.com/repos/dimsav/laravel-translatable/issues/comments/252149460","html_url":"https://github.com/dimsav/laravel-translatable/issues/171#issuecomment-252149460","issue_url":"https://api.github.com/repos/dimsav/laravel-translatable/issues/171","id":252149460,"user":{"login":"allamgr","id":1780017,"avatar_url":"https://avatars.githubusercontent.com/u/1780017?v=3","gravatar_id":"","url":"https://api.github.com/users/allamgr","html_url":"https://github.com/allamgr","followers_url":"https://api.github.com/users/allamgr/followers","following_url":"https://api.github.com/users/allamgr/following{/other_user}","gists_url":"https://api.github.com/users/allamgr/gists{/gist_id}","starred_url":"https://api.github.com/users/allamgr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allamgr/subscriptions","organizations_url":"https://api.github.com/users/allamgr/orgs","repos_url":"https://api.github.com/users/allamgr/repos","events_url":"https://api.github.com/users/allamgr/events{/privacy}","received_events_url":"https://api.github.com/users/allamgr/received_events","type":"User","site_admin":false},"created_at":"2016-10-07T04:17:21Z","updated_at":"2016-10-07T04:17:21Z","body":"I made a little change in the \"getAttribute\" method, instead of return null, the method will return the original parent method.\r\n\r\nOriginal \r\nif ($this->getTranslation($locale) === null) {\r\n      return null;\r\n}\r\n\r\nWith changes\r\nif ($this->getTranslation($locale) === null) {\r\n      return parent::getAttribute($key);\r\n}\r\n\r\nI don't know if break some conventions but it solve my problem."}}
{"actor":{"display_login":"allamgr"}}