{"action":"created","issue":{"url":"https://api.github.com/repos/dimsav/laravel-translatable/issues/491","repository_url":"https://api.github.com/repos/dimsav/laravel-translatable","labels_url":"https://api.github.com/repos/dimsav/laravel-translatable/issues/491/labels{/name}","comments_url":"https://api.github.com/repos/dimsav/laravel-translatable/issues/491/comments","events_url":"https://api.github.com/repos/dimsav/laravel-translatable/issues/491/events","html_url":"https://github.com/dimsav/laravel-translatable/issues/491","id":337287327,"node_id":"MDU6SXNzdWUzMzcyODczMjc=","number":491,"title":"Factory seeding with dynamic locales","user":{"login":"failedCoder","id":25980393,"node_id":"MDQ6VXNlcjI1OTgwMzkz","avatar_url":"https://avatars2.githubusercontent.com/u/25980393?v=4","gravatar_id":"","url":"https://api.github.com/users/failedCoder","html_url":"https://github.com/failedCoder","followers_url":"https://api.github.com/users/failedCoder/followers","following_url":"https://api.github.com/users/failedCoder/following{/other_user}","gists_url":"https://api.github.com/users/failedCoder/gists{/gist_id}","starred_url":"https://api.github.com/users/failedCoder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/failedCoder/subscriptions","organizations_url":"https://api.github.com/users/failedCoder/orgs","repos_url":"https://api.github.com/users/failedCoder/repos","events_url":"https://api.github.com/users/failedCoder/events{/privacy}","received_events_url":"https://api.github.com/users/failedCoder/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-01T12:29:13Z","updated_at":"2018-07-01T14:06:38Z","closed_at":null,"author_association":"NONE","body":"How to factory seed a translatable model without hardcoding the locales?\r\n\r\nThere are two values that I have to seed, slug which is not translatable, and title which has to be translated to all the languages from the languages table.\r\n\r\nHere is the factory file:\r\n\r\n```\r\n$factory->define(App\\Category::class, function (Faker $faker) {\r\n\r\n $counter = 1;\r\n $locales = Language::pluck('lang'); //returns hr,en,de\r\n $titles = [];\r\n\r\n foreach ($locales as $locale) {\r\n    $titles[$locale] = [\r\n        'title' => 'Title for category-' .$counter++. ' on '. $locale . ' language'\r\n    ];\r\n }\r\n\r\n/*\r\n$titles = \r\n     \"hr\" => array:1 [\r\n        \"title\" => \"Title for category-1 on hr language\"\r\n     ]\r\n     \"en\" => array:1 [\r\n        \"title\" => \"Title for category-2 on en language\"\r\n      ...\r\n */\r\n\r\nreturn [\r\n    'slug' => 'category-'.$counter++,\r\n    $titles\r\n];\r\n});\r\n```\r\nThis gives me an error:\r\n\r\n> Column not found: 1054 Unknown column 'hr'\r\n\r\nQuery created by the factory:\r\n\r\n`insert in to category_translations (locale, hr, en, de, test, category_id) values (0, Title for category-1 on hr language, Title for category-2 on en language, Title for category-3 on de languag e, Title for category-4 on test language, 20))`"},"comment":{"url":"https://api.github.com/repos/dimsav/laravel-translatable/issues/comments/401609222","html_url":"https://github.com/dimsav/laravel-translatable/issues/491#issuecomment-401609222","issue_url":"https://api.github.com/repos/dimsav/laravel-translatable/issues/491","id":401609222,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMTYwOTIyMg==","user":{"login":"Gummibeer","id":6187884,"node_id":"MDQ6VXNlcjYxODc4ODQ=","avatar_url":"https://avatars1.githubusercontent.com/u/6187884?v=4","gravatar_id":"","url":"https://api.github.com/users/Gummibeer","html_url":"https://github.com/Gummibeer","followers_url":"https://api.github.com/users/Gummibeer/followers","following_url":"https://api.github.com/users/Gummibeer/following{/other_user}","gists_url":"https://api.github.com/users/Gummibeer/gists{/gist_id}","starred_url":"https://api.github.com/users/Gummibeer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gummibeer/subscriptions","organizations_url":"https://api.github.com/users/Gummibeer/orgs","repos_url":"https://api.github.com/users/Gummibeer/repos","events_url":"https://api.github.com/users/Gummibeer/events{/privacy}","received_events_url":"https://api.github.com/users/Gummibeer/received_events","type":"User","site_admin":false},"created_at":"2018-07-01T14:06:38Z","updated_at":"2018-07-01T14:06:38Z","author_association":"COLLABORATOR","body":"Have you set the locales in the config under locales?\r\nIf you choose a DB driven locale management you can use a service provider to do this."}}
{"actor":{"display_login":"Gummibeer"}}