{"action":"closed","number":8066,"pull_request":{"url":"https://api.github.com/repos/laravel/framework/pulls/8066","id":31563225,"html_url":"https://github.com/laravel/framework/pull/8066","diff_url":"https://github.com/laravel/framework/pull/8066.diff","patch_url":"https://github.com/laravel/framework/pull/8066.patch","issue_url":"https://api.github.com/repos/laravel/framework/issues/8066","number":8066,"state":"closed","locked":false,"title":"Money","user":{"login":"browner12","id":5232313,"avatar_url":"https://avatars.githubusercontent.com/u/5232313?v=3","gravatar_id":"","url":"https://api.github.com/users/browner12","html_url":"https://github.com/browner12","followers_url":"https://api.github.com/users/browner12/followers","following_url":"https://api.github.com/users/browner12/following{/other_user}","gists_url":"https://api.github.com/users/browner12/gists{/gist_id}","starred_url":"https://api.github.com/users/browner12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/browner12/subscriptions","organizations_url":"https://api.github.com/users/browner12/orgs","repos_url":"https://api.github.com/users/browner12/repos","events_url":"https://api.github.com/users/browner12/events{/privacy}","received_events_url":"https://api.github.com/users/browner12/received_events","type":"User","site_admin":false},"body":"the ability to automatically create Carbon objects from a stored value is great. I think this feature should be extended to automatically create Money objects from a stored value.\r\n\r\nThis commit uses the same basic techniques to convert values to Carbon objects, and applies them to create Money objects.\r\n\r\nTo utilize this functionality it is as simple as creating a `monies` property on your model, with the key being the field/attribute name, and the value being the currency you wish to use for it.\r\n\r\n````php\r\nprotected $monies = [\r\n    'price'  => 'usd',\r\n    'price2' => 'eur',\r\n    'price3' => 'aud',\r\n];\r\n````\r\n\r\nthis also adds a helper method for migrations to create a money field.  it is simply a wrapper for unsigned integer. this means that monies should be stored in their sub units (i.e cents) rather than their base units (i.e. dollars).\r\n\r\n````php\r\n$table->money('price')\r\n````\r\n\r\nI am using a Money package I created myself. Obviously I would be an idiot if I didn't try with my package first, but there are other money packages available if need be.\r\n\r\nthis commit is fully backwards compatible, but as a new feature should probably be released in a minor update.","created_at":"2015-03-19T20:33:26Z","updated_at":"2015-03-19T20:54:14Z","closed_at":"2015-03-19T20:54:14Z","merged_at":null,"merge_commit_sha":"d1af088402fdb3e74e7bc13cd49f27a1aa82554f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/laravel/framework/pulls/8066/commits","review_comments_url":"https://api.github.com/repos/laravel/framework/pulls/8066/comments","review_comment_url":"https://api.github.com/repos/laravel/framework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/laravel/framework/issues/8066/comments","statuses_url":"https://api.github.com/repos/laravel/framework/statuses/e08f9b327b77d696eb8fc13451873b2ce5481c0c","head":{"label":"browner12:money","ref":"money","sha":"e08f9b327b77d696eb8fc13451873b2ce5481c0c","user":{"login":"browner12","id":5232313,"avatar_url":"https://avatars.githubusercontent.com/u/5232313?v=3","gravatar_id":"","url":"https://api.github.com/users/browner12","html_url":"https://github.com/browner12","followers_url":"https://api.github.com/users/browner12/followers","following_url":"https://api.github.com/users/browner12/following{/other_user}","gists_url":"https://api.github.com/users/browner12/gists{/gist_id}","starred_url":"https://api.github.com/users/browner12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/browner12/subscriptions","organizations_url":"https://api.github.com/users/browner12/orgs","repos_url":"https://api.github.com/users/browner12/repos","events_url":"https://api.github.com/users/browner12/events{/privacy}","received_events_url":"https://api.github.com/users/browner12/received_events","type":"User","site_admin":false},"repo":{"id":32495062,"name":"framework","full_name":"browner12/framework","owner":{"login":"browner12","id":5232313,"avatar_url":"https://avatars.githubusercontent.com/u/5232313?v=3","gravatar_id":"","url":"https://api.github.com/users/browner12","html_url":"https://github.com/browner12","followers_url":"https://api.github.com/users/browner12/followers","following_url":"https://api.github.com/users/browner12/following{/other_user}","gists_url":"https://api.github.com/users/browner12/gists{/gist_id}","starred_url":"https://api.github.com/users/browner12/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/browner12/subscriptions","organizations_url":"https://api.github.com/users/browner12/orgs","repos_url":"https://api.github.com/users/browner12/repos","events_url":"https://api.github.com/users/browner12/events{/privacy}","received_events_url":"https://api.github.com/users/browner12/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/browner12/framework","description":"","fork":true,"url":"https://api.github.com/repos/browner12/framework","forks_url":"https://api.github.com/repos/browner12/framework/forks","keys_url":"https://api.github.com/repos/browner12/framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/browner12/framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/browner12/framework/teams","hooks_url":"https://api.github.com/repos/browner12/framework/hooks","issue_events_url":"https://api.github.com/repos/browner12/framework/issues/events{/number}","events_url":"https://api.github.com/repos/browner12/framework/events","assignees_url":"https://api.github.com/repos/browner12/framework/assignees{/user}","branches_url":"https://api.github.com/repos/browner12/framework/branches{/branch}","tags_url":"https://api.github.com/repos/browner12/framework/tags","blobs_url":"https://api.github.com/repos/browner12/framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/browner12/framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/browner12/framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/browner12/framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/browner12/framework/statuses/{sha}","languages_url":"https://api.github.com/repos/browner12/framework/languages","stargazers_url":"https://api.github.com/repos/browner12/framework/stargazers","contributors_url":"https://api.github.com/repos/browner12/framework/contributors","subscribers_url":"https://api.github.com/repos/browner12/framework/subscribers","subscription_url":"https://api.github.com/repos/browner12/framework/subscription","commits_url":"https://api.github.com/repos/browner12/framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/browner12/framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/browner12/framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/browner12/framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/browner12/framework/contents/{+path}","compare_url":"https://api.github.com/repos/browner12/framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/browner12/framework/merges","archive_url":"https://api.github.com/repos/browner12/framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/browner12/framework/downloads","issues_url":"https://api.github.com/repos/browner12/framework/issues{/number}","pulls_url":"https://api.github.com/repos/browner12/framework/pulls{/number}","milestones_url":"https://api.github.com/repos/browner12/framework/milestones{/number}","notifications_url":"https://api.github.com/repos/browner12/framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/browner12/framework/labels{/name}","releases_url":"https://api.github.com/repos/browner12/framework/releases{/id}","created_at":"2015-03-19T01:57:52Z","updated_at":"2015-03-19T01:57:57Z","pushed_at":"2015-03-19T20:16:07Z","git_url":"git://github.com/browner12/framework.git","ssh_url":"git@github.com:browner12/framework.git","clone_url":"https://github.com/browner12/framework.git","svn_url":"https://github.com/browner12/framework","homepage":"http://laravel.com","size":60130,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"5.0"}},"base":{"label":"laravel:5.0","ref":"5.0","sha":"8e7adc7fc2047a666c6c344b23e2613bd3708d15","user":{"login":"laravel","id":958072,"avatar_url":"https://avatars.githubusercontent.com/u/958072?v=3","gravatar_id":"","url":"https://api.github.com/users/laravel","html_url":"https://github.com/laravel","followers_url":"https://api.github.com/users/laravel/followers","following_url":"https://api.github.com/users/laravel/following{/other_user}","gists_url":"https://api.github.com/users/laravel/gists{/gist_id}","starred_url":"https://api.github.com/users/laravel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laravel/subscriptions","organizations_url":"https://api.github.com/users/laravel/orgs","repos_url":"https://api.github.com/users/laravel/repos","events_url":"https://api.github.com/users/laravel/events{/privacy}","received_events_url":"https://api.github.com/users/laravel/received_events","type":"Organization","site_admin":false},"repo":{"id":7548986,"name":"framework","full_name":"laravel/framework","owner":{"login":"laravel","id":958072,"avatar_url":"https://avatars.githubusercontent.com/u/958072?v=3","gravatar_id":"","url":"https://api.github.com/users/laravel","html_url":"https://github.com/laravel","followers_url":"https://api.github.com/users/laravel/followers","following_url":"https://api.github.com/users/laravel/following{/other_user}","gists_url":"https://api.github.com/users/laravel/gists{/gist_id}","starred_url":"https://api.github.com/users/laravel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/laravel/subscriptions","organizations_url":"https://api.github.com/users/laravel/orgs","repos_url":"https://api.github.com/users/laravel/repos","events_url":"https://api.github.com/users/laravel/events{/privacy}","received_events_url":"https://api.github.com/users/laravel/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/laravel/framework","description":"","fork":false,"url":"https://api.github.com/repos/laravel/framework","forks_url":"https://api.github.com/repos/laravel/framework/forks","keys_url":"https://api.github.com/repos/laravel/framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/laravel/framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/laravel/framework/teams","hooks_url":"https://api.github.com/repos/laravel/framework/hooks","issue_events_url":"https://api.github.com/repos/laravel/framework/issues/events{/number}","events_url":"https://api.github.com/repos/laravel/framework/events","assignees_url":"https://api.github.com/repos/laravel/framework/assignees{/user}","branches_url":"https://api.github.com/repos/laravel/framework/branches{/branch}","tags_url":"https://api.github.com/repos/laravel/framework/tags","blobs_url":"https://api.github.com/repos/laravel/framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/laravel/framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/laravel/framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/laravel/framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/laravel/framework/statuses/{sha}","languages_url":"https://api.github.com/repos/laravel/framework/languages","stargazers_url":"https://api.github.com/repos/laravel/framework/stargazers","contributors_url":"https://api.github.com/repos/laravel/framework/contributors","subscribers_url":"https://api.github.com/repos/laravel/framework/subscribers","subscription_url":"https://api.github.com/repos/laravel/framework/subscription","commits_url":"https://api.github.com/repos/laravel/framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/laravel/framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/laravel/framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/laravel/framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/laravel/framework/contents/{+path}","compare_url":"https://api.github.com/repos/laravel/framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/laravel/framework/merges","archive_url":"https://api.github.com/repos/laravel/framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/laravel/framework/downloads","issues_url":"https://api.github.com/repos/laravel/framework/issues{/number}","pulls_url":"https://api.github.com/repos/laravel/framework/pulls{/number}","milestones_url":"https://api.github.com/repos/laravel/framework/milestones{/number}","notifications_url":"https://api.github.com/repos/laravel/framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/laravel/framework/labels{/name}","releases_url":"https://api.github.com/repos/laravel/framework/releases{/id}","created_at":"2013-01-10T21:27:28Z","updated_at":"2015-03-19T19:24:38Z","pushed_at":"2015-03-19T20:33:26Z","git_url":"git://github.com/laravel/framework.git","ssh_url":"git@github.com:laravel/framework.git","clone_url":"https://github.com/laravel/framework.git","svn_url":"https://github.com/laravel/framework","homepage":"http://laravel.com","size":60130,"stargazers_count":3331,"watchers_count":3331,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1818,"mirror_url":null,"open_issues_count":87,"forks":1818,"open_issues":87,"watchers":3331,"default_branch":"5.0"}},"_links":{"self":{"href":"https://api.github.com/repos/laravel/framework/pulls/8066"},"html":{"href":"https://github.com/laravel/framework/pull/8066"},"issue":{"href":"https://api.github.com/repos/laravel/framework/issues/8066"},"comments":{"href":"https://api.github.com/repos/laravel/framework/issues/8066/comments"},"review_comments":{"href":"https://api.github.com/repos/laravel/framework/pulls/8066/comments"},"review_comment":{"href":"https://api.github.com/repos/laravel/framework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/laravel/framework/pulls/8066/commits"},"statuses":{"href":"https://api.github.com/repos/laravel/framework/statuses/e08f9b327b77d696eb8fc13451873b2ce5481c0c"}},"merged":false,"mergeable":true,"mergeable_state":"clean","merged_by":null,"comments":3,"review_comments":6,"commits":4,"additions":145,"deletions":0,"changed_files":4}}