This project provides a set of APIs to manage the financial transactions of a company. It's built using Laravel and features robust authentication and role-based authorization.
- Authentication: Utilizes Laravel Sanctum for secure token-based authentication.
- Authorization: Implements role-based authorization using
spatie/laravel-permission
.
- PHP >= 7.4
- MySQL (or database of your choice)
- Composer
git clone https://github.com/yehia-khalil/transactions-manager.git
Navigate to the project folder and install the required PHP packages:
cd transactions-manager
composer install
php artisan key:generate
Copy .env.example
to .env
and update the database credentials:
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database_name
DB_USERNAME=your_username
DB_PASSWORD=your_password
Run the migration and seed the database:
php artisan migrate --seed
This will create the required database tables and seed in two roles: admin
and user
. It will also create 10 users and an admin account with the following credentials:
- Email:
[email protected]
- Password:
password
To seed in categories, subcategories, transactions for the past 3 years and upcoming 2 years with 3 transactions per year, and their payments, run:
php artisan db:seed --class=TransactionSeeder
Once the setup is complete, you can start the development server by running:
php artisan serve
The API will be available at http://127.0.0.1:8000/
.
To generate a monthly report for financial performance over a specified date range, you can run the following Artisan command:
php artisan report:generate {start_date} {end_date}
Replace {start_date}
and {end_date}
with the desired date range in YYYY-MM-DD format. For example:
php artisan php artisan report:generate 2020-01-01 2025-01-01
This command will run a job to query the transactions, aggregate the data, and generate an Excel report. The report will then be downloaded to your computer.
You can find the postman collection .json file inside the project