{"id":16412832,"url":"https://github.com/script47/acme-widget-co","last_synced_at":"2025-08-27T13:20:41.208Z","repository":{"id":39221634,"uuid":"241771550","full_name":"Script47/Acme-Widget-Co","owner":"Script47","description":null,"archived":false,"fork":false,"pushed_at":"2023-01-05T07:47:39.000Z","size":2621,"stargazers_count":0,"open_issues_count":25,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-28T17:08:21.191Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Script47.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-20T02:06:03.000Z","updated_at":"2020-06-15T14:37:29.000Z","dependencies_parsed_at":"2023-02-03T19:02:20.699Z","dependency_job_id":null,"html_url":"https://github.com/Script47/Acme-Widget-Co","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Script47%2FAcme-Widget-Co","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Script47%2FAcme-Widget-Co/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Script47%2FAcme-Widget-Co/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Script47%2FAcme-Widget-Co/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Script47","download_url":"https://codeload.github.com/Script47/Acme-Widget-Co/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229893950,"owners_count":18140616,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T06:49:54.675Z","updated_at":"2024-12-16T00:28:24.713Z","avatar_url":"https://github.com/Script47.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Summary\n\nThis solution outlines how a simple product/basket system would work. The idea was to make it in such a way that it would be flexible. This is exemplified through the approach taken with a rudimentary rules system which is baked into the basket for offers/discounts.\n\n# Setup\n\n```\n# install dependencies\ncomposer install\n\n# run migrations and seed the db\nphp artisan migrate:fresh --seed\n```\n\n**Note:** Don't forget to set the db credentials in the `.env` file and create a db called `acme_widget_co`.\n\n# Usage\n\n```\n# Create basket\nphp artisan basket:create\n\n# Add product (using product code)\nphp artisan product:add --products=R01,B01 --basket=1\n\n# List the contents of the basket (with cost breakdown)\nphp artisan basket:list --basket=1\n\n# Empty the basket\nphp artisan basket:empty --basket=1\n\n# Delete the basket\nphp artisan basket:delete --basket=1\n```\n\n# Test Cases\n\n**B01, G01**\n\n```\n\u003e php artisan basket:create\n\u003e Basket 1 has been created.\n\u003e php artisan product:add --products=G01,B01 --basket=1\n\u003e 2 product(s) have been added to the basket.\n\u003e php artisan basket:list --basket=1\n\u003e -------------------------\n\u003e Basket #1\n\u003e -------------------------\n\u003e Products: G01, B01\n\u003e Subtotal: 32.90\n\u003e Delivery: 4.95\n\u003e Discount: 0.00\n\u003e Total: 37.85\n\u003e -------------------------\n\u003e php artisan basket:empty --basket=1\n\u003e Basket 1 has been emptied.\n```\n\n**B01, B01, R01, R01, R01**\n\n```\n\u003e php artisan product:add --products=B01,B01,R01,R01,R01 --basket=1\n\u003e 5 product(s) have been added to the basket.\n\u003e php artisan basket:list --basket=1\n\u003e -------------------------\n\u003e Basket #1\n\u003e -------------------------\n\u003e Products: B01, B01, R01, R01, R01\n\u003e Subtotal: 114.75\n\u003e Delivery: 0\n\u003e Discount: 16.48\n\u003e Total: 98.27\n\u003e -------------------------\n\n```\n\n# Assumptions\n\n- The offer/discount system isn't supposed to be future proofed.\n- We'll only ever have a single \"active\" rule being checked against proucts\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscript47%2Facme-widget-co","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscript47%2Facme-widget-co","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscript47%2Facme-widget-co/lists"}