/restaurants-stock-orders

Simple project to allow restaurants to get products with ingredients with alert when one of ingredient low in stock

Primary LanguagePHP

Restaurants Stock Orders

Table of Contents

  1. About The Project
  2. Getting Started
  3. Usage
  4. Database Digram
  5. Testing
  6. Images
  7. Contributing
  8. License

About The Project

img_1.png

Built With

  • Laravel V10.3.3
  • Filament V2.17.16
  • Bootstrap V5.3.0-alpha

Getting Started

To get a local copy up and running follow these simple steps.

Prerequisites

This is an example of how to list things you need to Prepare.

  • Local Server Or Live Server
  • PHP Version 8.1+
  • Composer Download From Here
  • Command Line and I prefer Git Bash You Can download it From Here

Installation

  • Clone the repo

    git clone https://github.com/EGYWEB-Mohamed/foodics_task.git
  • Install Required packages With composer

    composer install
  • Copy .env.example file and rename it with .env

      cp .env.example .env
  • Generate Key

    php artisan key:generate
    
  • Create Two Database

    • Testing DB_TEST_DATABASE
    • Live DB_DATABASE
  • Fill .env File With Important Data

    DB_DATABASE=
    DB_TEST_DATABASE=
    DB_USERNAME=
    DB_PASSWORD=
    ....
    MAIL_HOST=
    MAIL_PORT=587
    MAIL_USERNAME=
    MAIL_PASSWORD=
    .....
    MERCHANT_MAIL="merchant@test.com"
    LOWEST_STOCK_PERCENTAGE=50

    And Don't Forget To Fill SMTP Data To Recive a notification Whenever Any Stock Is Low You can also specify when you will receive an alert when a certain percentage is reached with LOWEST_STOCK_PERCENTAGE 😉

  • Then Run To Migrate All Database Also to seed with dummy data

    php artisan migration --seed
    
    • Account Credential
      Email : admin@test.com
      Password :  123456
      
  • If your using local server don't forget to run php artisan serv or you can navigate from localhost correct installation path

  • Don't Forget To run queue worker so it's important to deliver the Email Notification

    php artisan queue:work
    
  • Want To Test The Whole Application and functionality ? Easy Jump To This Part


Usage

In a system that has three main models; Product, Ingredient, and Order. A Burger (Product) may have several ingredients:

  • 150g Beef
  • 30g Cheese
  • 20g Onion

The system keeps the stock of each of these ingredients stored in the database. You can use the following levels for seeding the database:

  • 20kg Beef
  • 5kg Cheese
  • 1kg Onion

When a customer makes an order that includes a Burger. The system needs to update the stock of each of the ingredients so it reflects the amounts consumed. Also when any of the ingredients stock level reaches 50%, the system should send an email message to alert the merchant they need to buy more of this ingredient.


Digram

img.png


Images

img_6.png img_2.png img_3.png img_4.png img_5.png img.png


Testing

When You Finish Setup the application you can easily run

php artisan test

img.png You Got Green Pass So What you are waiting for 😂


Test Cases Coverage:

✔️ Is Home Page Work ?
✔️ Is Home Page Has Products ?
✔️ Is There Auth Links ?
✔️ Is Auth Required To Buy New Product ?
✔️ Is User Can Login Successfully ?
✔️ Is there Logout and Dashboard Link ?
✔️ Is Dashboard Work ?
✔️ Is Orders Page Work ?
✔️ Is Products Page Work ?
✔️ Is Ingredients Page Work ?
✔️ Is There Burger Product With its Ingredients Exists?
️✔️ Is Buy Button Work ?
✔️ Is Product Ingredients Stock 100% ?
✔️ Is Order Added To DB ?
✔️ Is Product Ingredients Decreased ?
✔️ Is Ingredients Decreased Is Correct ?

14 Test Case With 34 assertions

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.