This API provides authentication, product management, order handling, and other functionalities for an e-commerce platform. It utilizes JWT authentication and enforces role-based access control (RBAC) for Admin, Staff, and Customer roles.
POST /login
- User loginPOST /signup
- User registrationPOST /sendForgotPasswordEmail
- Send password reset emailPUT /resetpassword/{user}
- Reset password (requires a valid token)
GET /products
- List all products (paginated)GET /productswithcolors
- List products with available colorsGET /productsizes
- List all product sizesGET /productwithcolors/{product}
- Get product details with colors
Requires auth:api
middleware
POST /imageupload
- Upload an image
GET /brandsWithDateFilter
- List brands with a date filterGET /brands
- List all brandsGET /brandsWithAll
- List all brands with additional data
GET /orders
- List all ordersGET /ownorders
- List user-specific ordersPOST /orders
- Create a new orderPUT /orders/{order}
- Update an order (order status updates trigger notifications)- Order status updates trigger notifications:
- PLACED: Order confirmation and payment received notification.
- PROCESSING: Order is being processed.
- FOR DELIVERY: Scheduled delivery notification.
- DELIVERED: Successful delivery notification.
- CANCELLED: Order cancellation and refund update notification.
- DELIVERY DATE CHANGED: User is notified of delivery date changes.
- Inventory updates when an order is marked as FOR DELIVERY:
- Product stock is committed to the order.
- Order status updates trigger notifications:
GET /checkouts
- List all checkoutsGET /checkout/{checkout_no}
- Get a checkout by IDPOST /checkouts
- Create a new checkout (separate from orders)
GET /orderstatus
- List order statuses
GET /notifications
- List all notificationsPUT /notifications/{notification}
- Update a notification- Notifications include:
- Order status updates
- Delivery date changes
- Email notifications for new user registration
GET /rates
- List ratingsPOST /rates
- Submit a rating
GET /order-cancellations
- List all order cancellationsGET /order-cancellations/{order_id}
- Get cancellation detailsPOST /order-cancellations
- Request order cancellationPUT /order-cancellations/{order_cancellation}
- Update order cancellation
GET /profile
- Get user profilePUT /profile/{user_id}
- Update user profile (users can update only their own profile)
POST /product/sizes
- Add a product sizePOST /product/sizes/client
- Add a product size for a client
Requires admin_staff
middleware
GET /usertypes
- List user typesGET /customers
- List customersGET /users
- List usersPOST /users
- Create a new user (role assignment supported)
POST /brands
- Create a new brandPUT /brands/{brand}
- Update brand detailsDELETE /brands/{brand}
- Delete a brand (soft delete)
POST /products
- Create a productPUT /products/{product}
- Update product detailsDELETE /products/{product}
- Delete a product (soft delete)GET /productsWithDateFilter
- Filter products by date
PUT /product/sizes/{size}
- Update product sizeDELETE /product/sizes/{size}
- Delete product sizeGET /productSizesWithDateFilter
- Filter product sizes by date
GET /product/colors
- List product colors with product & brandPOST /product/colors
- Add a product colorPUT /product/colors/{color}
- Update a product colorDELETE /product/colors/{color}
- Delete a product colorGET /productColorsWithDateFilter
- Filter product colors by date
GET /payments
- List paymentsGET /paymentsWithDateFilter
- Filter payments by date
GET /inventories
- List inventoriesGET /inventories/{color_id}
- Get inventory details by color IDPOST /inventories
- Add inventory data- Inventory Updates:
- When an order is FOR DELIVERY, the corresponding product stock is marked as committed.
GET /dashboard
- Get dashboard analyticsGET /accreceivable
- List account receivablesGET /accountsReceivableWithDateFilter
- Filter account receivables by date
Requires customer
middleware
GET /colors/{color}
- Get product color details
POST /productsizes
- Add a product size
GET /cart
- View cartPOST /cart
- Add/update cart itemsPUT /cart/{cart}
- Update cart itemDELETE /cart
- Clear cart (removes all items)
- PHP 7.3+ or 8.0+
- Composer
- MySQL
- Node.js (for front-end assets)
-
Clone the Repository:
git clone using ssh or https cd ecommerce-blinds-laravel-api
-
Install Dependencies:
composer install npm install
-
Set Up Environment:
cp .env.example .env php artisan key:generate
-
Configure Database: Edit the
.env
file with your database credentials:DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=your_database DB_USERNAME=your_username DB_PASSWORD=your_password
-
Run Migrations and Seed Data:
php artisan migrate --seed
-
Start the Server:
php artisan serve
The app will be accessible at
http://127.0.0.1:8000
.
The Ecommerce Blinds API provides a robust, secure, and scalable backend solution for managing an e-commerce platform. With comprehensive role-based authentication, order processing, and inventory management, this API ensures a seamless shopping experience for customers while maintaining efficient operations for administrators and staff. Future enhancements can include integrating third-party payment gateways, real-time analytics, and improved customer engagement features.