|
| 1 | +# Product Catalog with Newsletter Subscription |
| 2 | + |
| 3 | +This project is a Laravel application that serves as a product catalog. Users can browse products and categories, subscribe to a newsletter, and receive updates about featured products. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- Browse products and categories |
| 8 | +- Filter products and categories by name |
| 9 | +- View products and categories by slug |
| 10 | +- Subscribe and unsubscribe to newsletters |
| 11 | +- Receive a welcome email upon subscription |
| 12 | +- Weekly newsletter with featured products |
| 13 | + |
| 14 | +## Requirements |
| 15 | + |
| 16 | +- PHP >= 8.2 |
| 17 | +- Composer |
| 18 | +- Laravel >= 11.x |
| 19 | +- MySQL or any supported database |
| 20 | + |
| 21 | +## Installation |
| 22 | + |
| 23 | +Follow these steps to set up and run the project locally. |
| 24 | + |
| 25 | +### 1. Clone the Repository |
| 26 | + |
| 27 | +### 2. Install Dependencies |
| 28 | + |
| 29 | +Run the following command to install the required packages: |
| 30 | + |
| 31 | +```bash |
| 32 | +composer install |
| 33 | +``` |
| 34 | + |
| 35 | +### 3. Set Up Environment File |
| 36 | + |
| 37 | +Copy the example environment file: |
| 38 | + |
| 39 | +```bash |
| 40 | +cp .env.example .env |
| 41 | +``` |
| 42 | + |
| 43 | +Then, update the `.env` file with your database credentials and mail configuration. |
| 44 | + |
| 45 | +Generate an application key: |
| 46 | + |
| 47 | +```bash |
| 48 | +php artisan key:generate |
| 49 | +``` |
| 50 | + |
| 51 | +### 4. Initialize the Application |
| 52 | + |
| 53 | +To run migrations and optionally seed the database, you can use the custom Artisan command: |
| 54 | + |
| 55 | +```bash |
| 56 | +php artisan app:init |
| 57 | +``` |
| 58 | + |
| 59 | +This command will: |
| 60 | +- Run all migrations. |
| 61 | +- Prompt you to run seeders. |
| 62 | +- Ask for an email and password to create a new user. |
| 63 | + |
| 64 | +### 5. Start the Development Server |
| 65 | + |
| 66 | +Run the following command to start the development server: |
| 67 | + |
| 68 | +```bash |
| 69 | +php artisan serve |
| 70 | +``` |
| 71 | + |
| 72 | +You can now access the application at `http://localhost:8000`. |
| 73 | + |
| 74 | +## API Endpoints |
| 75 | + |
| 76 | +### Categories |
| 77 | + |
| 78 | +- **List Categories**: `GET /api/categories?name=example` |
| 79 | +- **View Category by Slug**: `GET /api/categories/slug/{slug}` |
| 80 | + |
| 81 | +### Products |
| 82 | + |
| 83 | +- **List Products**: `GET /api/products?name=example` |
| 84 | +- **View Product by Slug**: `GET /api/products/slug/{slug}` |
| 85 | + |
| 86 | +### Subscribers |
| 87 | + |
| 88 | +- **Subscribe**: `POST /api/subscribe` (requires an email) |
| 89 | +- **Unsubscribe**: `DELETE /api/unsubscribe` (requires an email) |
| 90 | + |
| 91 | +## Technologies Used |
| 92 | + |
| 93 | +- Laravel |
| 94 | +- PHP |
| 95 | +- MySQL |
| 96 | +- Blade (for views) |
| 97 | +- Eloquent ORM |
| 98 | +- Filament (Admin panel) |
| 99 | + |
| 100 | +## License |
| 101 | + |
| 102 | +This project is licensed under the MIT License. |
0 commit comments