{"action":"created","issue":{"url":"https://api.github.com/repos/Maatwebsite/Laravel-Excel/issues/1871","repository_url":"https://api.github.com/repos/Maatwebsite/Laravel-Excel","labels_url":"https://api.github.com/repos/Maatwebsite/Laravel-Excel/issues/1871/labels{/name}","comments_url":"https://api.github.com/repos/Maatwebsite/Laravel-Excel/issues/1871/comments","events_url":"https://api.github.com/repos/Maatwebsite/Laravel-Excel/issues/1871/events","html_url":"https://github.com/Maatwebsite/Laravel-Excel/issues/1871","id":377269783,"node_id":"MDU6SXNzdWUzNzcyNjk3ODM=","number":1871,"title":"How can I import calculated values?","user":{"login":"cosecantt","id":5255217,"node_id":"MDQ6VXNlcjUyNTUyMTc=","avatar_url":"https://avatars3.githubusercontent.com/u/5255217?v=4","gravatar_id":"","url":"https://api.github.com/users/cosecantt","html_url":"https://github.com/cosecantt","followers_url":"https://api.github.com/users/cosecantt/followers","following_url":"https://api.github.com/users/cosecantt/following{/other_user}","gists_url":"https://api.github.com/users/cosecantt/gists{/gist_id}","starred_url":"https://api.github.com/users/cosecantt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cosecantt/subscriptions","organizations_url":"https://api.github.com/users/cosecantt/orgs","repos_url":"https://api.github.com/users/cosecantt/repos","events_url":"https://api.github.com/users/cosecantt/events{/privacy}","received_events_url":"https://api.github.com/users/cosecantt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":9,"created_at":"2018-11-05T06:45:12Z","updated_at":"2018-11-07T08:49:58Z","closed_at":null,"author_association":"NONE","body":"<!--\r\n\r\n\r\nHow can I import calculated values?\r\n\r\n-->\r\n\r\n### Prerequisites\r\n\r\n### Versions\r\n\r\n<!-- Please be as exact and complete as possible when proving version numbers -->\r\n\r\n* PHP version: 7.2.9\r\n* Laravel version: 5.5.40\r\n* Package version: 3.1\r\n\r\n### Description\r\n\r\nHow can I import calculated values?\r\n\r\nImported excel file returns following values and the formula is not calculated for maximum_stock:\r\n\r\n````\r\n{\r\n   \"minimum_stock\": 10,\r\n   \"maximum_stock\": \"=Z3*2\",\r\n   \"stock\": 5\r\n}\r\n````\r\n\r\n### Additional Information\r\nI set config\r\n````\r\n'pre_calculate_formulas' => true,\r\n````\r\nbut it seems that above config missing for import\r\n\r\n````\r\nnamespace App\\Imports;\r\n\r\nuse App\\Product;\r\nuse Maatwebsite\\Excel\\Concerns\\ToModel;\r\nuse Maatwebsite\\Excel\\Concerns\\WithHeadingRow;\r\nuse Maatwebsite\\Excel\\Concerns\\WithBatchInserts;\r\nuse Maatwebsite\\Excel\\Concerns\\WithCalculatedFormulas;\r\n\r\nclass ProductImport implements ToModel, WithHeadingRow, WithBatchInserts, WithCalculatedFormulas\r\n{\r\n    /**\r\n    * @param array $row\r\n    *\r\n    * @return \\Illuminate\\Database\\Eloquent\\Model|null\r\n    */\r\n    public function model(array $row)\r\n    {\r\n        $row['user_id'] = auth()->user()->id;\r\n        $row['code'] = $row['product_code'];\r\n\r\n        return new Product($row);\r\n    }\r\n\r\n    public function headingRow(): int\r\n    {\r\n        return 2;\r\n    }\r\n\r\n    public function batchSize(): int\r\n    {\r\n        return 100;\r\n    }\r\n}\r\n````\r\nOr am I missing something in the code. Cannot find example on documentation. Thanks!"},"comment":{"url":"https://api.github.com/repos/Maatwebsite/Laravel-Excel/issues/comments/436549345","html_url":"https://github.com/Maatwebsite/Laravel-Excel/issues/1871#issuecomment-436549345","issue_url":"https://api.github.com/repos/Maatwebsite/Laravel-Excel/issues/1871","id":436549345,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNjU0OTM0NQ==","user":{"login":"patrickbrouwers","id":7728097,"node_id":"MDQ6VXNlcjc3MjgwOTc=","avatar_url":"https://avatars2.githubusercontent.com/u/7728097?v=4","gravatar_id":"","url":"https://api.github.com/users/patrickbrouwers","html_url":"https://github.com/patrickbrouwers","followers_url":"https://api.github.com/users/patrickbrouwers/followers","following_url":"https://api.github.com/users/patrickbrouwers/following{/other_user}","gists_url":"https://api.github.com/users/patrickbrouwers/gists{/gist_id}","starred_url":"https://api.github.com/users/patrickbrouwers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/patrickbrouwers/subscriptions","organizations_url":"https://api.github.com/users/patrickbrouwers/orgs","repos_url":"https://api.github.com/users/patrickbrouwers/repos","events_url":"https://api.github.com/users/patrickbrouwers/events{/privacy}","received_events_url":"https://api.github.com/users/patrickbrouwers/received_events","type":"User","site_admin":false},"created_at":"2018-11-07T08:49:58Z","updated_at":"2018-11-07T08:49:58Z","author_association":"MEMBER","body":"@cosecantt feel free to submit a PR with a failing test for it. And if you figure out what causes it to not work, feel free to PR that too :)"}}
{"actor":{"display_login":"patrickbrouwers"}}