This project is a back-end system designed for a pharmacy to streamline its business processes, including authentication, medication inventory management, and customer record management. The system enforces user roles and permissions for different actions to ensure security and efficiency.
- Official Laravel package for API token authentication.
- Documentation
- Package for managing user permissions and roles in Laravel applications.
- Documentation
- PHP ^8.1
- Laravel 10
- SQLite (3.39.2)
- Postman (for testing)
Clone the project
git clone https://github.com/dmunasingha/pharmacy-project
Go to the project directory
cd pharmacy-project
Install PHP dependencies
composer install
Copy the Enviroment File
copy .env.example .env
Generate Application Key
php artisan key:generate
Run Database Migrations (without dummy data)
php artisan migrate
or
Run Database Migrations (with dummy data)
php artisan migrate --seed
Start the development server
php artisan serve
- Project
- ER Diagram (er.svg & er.mwb)
- Postman Collection (Pharmacy Application. postman_collection.json)
- Database Export (database/export.sql)
To access the API endpoints, you need to authenticate your requests using a bearer token. Follow these steps to obtain a bearer token:
When login a token will be received copy it and go to the authorization tab select the type as Bearer Token and paste the copied token in it (Individualy on each HTTP Requests or for the Collection)
POST /api/login
Parameter | Type | Description |
---|---|---|
email |
string |
Required. |
password |
string |
Required. |
POST /api/register
Parameter | Type | Description |
---|---|---|
name |
string |
Required. |
email |
string |
Required. |
password |
string |
Required. |
password_confirmation |
string |
Required. |
role |
string |
Required. |
POST /api/logout
GET /api/roles
POST /api/roles
Parameter | Type | Description |
---|---|---|
name |
string |
Required. |
GET /api/roles/{id}
POST /api/roles/{id}
Parameter | Type | Description |
---|---|---|
name |
string |
Required. |
DELETE /api/roles/{id}
POST /api/roles/permissions
Parameter | Type | Description |
---|---|---|
role |
string |
Required. Role Name |
permission |
string |
Required. Permission Name |
GET /api/medications
POST /api/medications
Parameter | Type | Description |
---|---|---|
name |
string |
Required. |
description |
string |
Required. |
quantity |
string |
Required. |
GET /api/medications/{id}
POST /api/medications/{id}
Parameter | Type | Description |
---|---|---|
name |
string |
Required. |
description |
string |
Required. |
quantity |
string |
Required. |
DELETE /api/medications/delete/{id}
DELETE /api/medications/{id}
GET /api/customers
POST /api/customers
Parameter | Type | Description |
---|---|---|
name |
string |
Required. |
contact |
string |
Required. |
email |
string |
Optional. |
address |
string |
Required. |
GET /api/customers/{id}
POST /api/customers/{id}
Parameter | Type | Description |
---|---|---|
name |
string |
Required. |
contact |
string |
Required. |
email |
string |
Optional. |
address |
string |
Required. |
DELETE /api/customers/delete/{id}
DELETE /api/customers/{id}
GET /api/users
GET /api/users/{id}
DELETE /api/users/delete/{id}