https://github.com/monarul007/beautybooth
This repository contains a Laravel-based project completed as part of an interview task for the Web Developer Backend (Laravel) position at Beauty Booth Bangladesh. It includes models, migrations, relationships, seeders, and a REST API to manage products and categories with sorting options like best-selling, top-rated, and price filters.
https://github.com/monarul007/beautybooth
api ecommerce laravel rest-api
Last synced: 5 months ago
JSON representation
This repository contains a Laravel-based project completed as part of an interview task for the Web Developer Backend (Laravel) position at Beauty Booth Bangladesh. It includes models, migrations, relationships, seeders, and a REST API to manage products and categories with sorting options like best-selling, top-rated, and price filters.
- Host: GitHub
- URL: https://github.com/monarul007/beautybooth
- Owner: Monarul007
- Created: 2024-09-15T17:53:22.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-16T08:32:36.000Z (almost 2 years ago)
- Last Synced: 2025-04-05T13:29:04.535Z (over 1 year ago)
- Topics: api, ecommerce, laravel, rest-api
- Language: PHP
- Homepage: https://beautybooth.com.bd/
- Size: 67.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Tasks for Laravel Interview
This is a Laravel app to manage products and categories. It includes sorting products by best selling, top-rated, and price.
## Features
- Sort products by:
- **Best Sell**: Based on the number of orders.
- **Top Rated**: Based on product reviews.
- **Price**: Sort from high to low or low to high.
## Models
- **Product**: `id`, `name`, `slug`, `price`
- **Category**: `id`, `name`, `slug`, `parent_id`
- **ProductCategory**: `product_id`, `category_id`
- **Order**: `id`, `grand_total`, `shipping_cost`, `discount`, `user_id`
- **OrderDetail**: `id`, `product_id`, `order_id`, `unit_price`, `quantity`
- **ProductReview**: `id`, `product_id`, `user_id`, `comment`, `rating`
## Installation
1. Clone the repository:
```bash
git clone https://github.com/Monarul007/beautyBooth.git
```
2. Install dependencies:
```bash
composer install
```
3. Set up `.env`:
```bash
cp .env.example .env
php artisan key:generate
```
4. Run migrations and seed the database:
```bash
php artisan migrate --seed
```
5. Start the server:
```bash
php artisan serve
```
## API
**Endpoint**: `/category/{slug}/products`
**Method**: `GET`
**Sort Options**:
- `?sort=best_sell`
- `?sort=top_rated`
- `?sort=price_high_to_low`
- `?sort=price_low_to_high`
Example: `/category/electronics/products?sort=best_sell`
## Seeder
Seeder uses Laravel factories to add random products, categories, and reviews efficiently.