Business Menus Model

ActionMethodResourceDescription
Get allGET/business/:business_id/menusGet all menus with business_id.
GetGET/business/:business_id/menus/:menu_idGet menu with id business_id and menu_id.
Create POST/business/:business_id/menusCreate a menu with business_id.
Update PUT/business/:business_id/menus/:menu_idUpdate menu with business_id and menu_id.
Delete DELETE/business/:business_id/menus/:menu_idDelete menu with business_id and menu_id.

The menu model is composed of the following attributes:

AttributeTypeRequiredDescriptionWhereable
namestringno, required to create.The menu's name.Yes
commentstringnoThe menu's comment.Yes
schedulejsonno, required to create.The menu's schedule. More about schedulesNo
pickupbooleanno, required to create.The menu's pickup.Yes
deliverybooleanno, required to create.The menu's delivery.Yes
eatinbooleannoThe menu's eat in.Yes
productsjsonnoThe menu's products. is an array with the products id ex. [3,24,35,46,...]No
enabledbooleannoThe menu's status.Yes
all_productsbooleannoThis will allow the menu to enable all products available on the store.Yes
use_business_schedulebooleannoThis will use by default the business schedule to create the menu schedule.Yes

📘

Restrictions for POST, PUT and DELETE menu.

Business menus can only be created, updated or removed by users level 0 (Type: Administrator) and user level 2 (Type: Business owner).

  • User type Administrator can create, update or remove any business menu from any business.
  • User Type Business owner can create, update or remove only business menus related to his business.

📘

GET responses for business menus.

In general, there is no restriction to obtain business menus but there are to paths to obtain it, data obtained depends on the type of user.

  • Normal.
  • mode:dashboard.

Therefore, depending on the mode and the type of user, the response will be obtained as shown below:

  • User type Administrator and mode:dashboard can get all business menus.
  • User type Business owner and mode:dashboard can obtain business menus related to his business.
  • Users type Customer can obtain all business menus bounded by the business they can get and if businesses menu are enable for his request. This is a compared example:

Note: mode:dashboard only can be used by used by user level 0 or 2. Any user without mode:dashboard make a request as user type customer (level 3).

{
    "error": false,
    "result": [
        {
            "id": 8,
            "business_id": 7,
            "name": "Delivery Menu",
            "comment": "Thanks!",
            "schedule": [...],
            "pickup": true,
            "delivery": true,
            "enabled": true,
            "products": [
                {
                    "id": 475,
                    "name": "Take Up Trousers",
                    "price": 14,
                    "description": "",
                    "images": "https://res.cloudinary.com/ordering/image/upload/v1490664570/hy90ae5toz13lkdle4a3.jpg",
                    "sku": null,
                    "category_id": 102,
                    "inventoried": false,
                    "quantity": 0,
                    "featured": false,
                    "enabled": true,
                    "pivot": {
                        "menu_id": 8,
                        "product_id": 475
                    }
                },
                ...
            ]
        }
        ... //(All enabled menus)
    ]
}
{
    "error": false,
    "result": [
        {
            "id": 8,
            "business_id": 7,
            "name": "Delivery Menu",
            "comment": "Thanks!",
            "schedule": [...],
            "pickup": true,
            "delivery": true,
            "enabled": false,
            "products": [
                {
                    "id": 475,
                    "name": "Take Up Trousers",
                    "price": 14,
                    "description": "",
                    "images": "https://res.cloudinary.com/ordering/image/upload/v1490664570/hy90ae5toz13lkdle4a3.jpg",
                    "sku": null,
                    "category_id": 102,
                    "inventoried": false,
                    "quantity": 0,
                    "featured": false,
                    "enabled": true,
                    "pivot": {
                        "menu_id": 8,
                        "product_id": 475
                    }
                },
                ...
            ]
        }
        ... //(All menus including disabled)
    ]
}