Aspire REST API

Laravel Code Challenge

Introduction

It is a simple REST API's for the private loan application. Authenticated users can able to request loan from lenders through loan application. Based on approval, loan will get sanction and repayment will start as per the term which customer mentioned in the loan request.

Prerequisites

  • PHP >= 7.4
  • Laravel >= 8.45
  • MySQL >= 10.4
  • Postman

Installation (Laravel 8.x)

Clone or download this repository

$ git clone https://github.com/quantm/laravel_code_challenge_aspire.git


Run in project folder

$ composer install


Rename the .env.example to .env

Configure database connection


Migration and Seed

Run in project folder:

$ php artisan migrate:fresh --seed

$ php artisan key:generate


In this demo, Have used laravel-passport package, which should install before start

$ composer require laravel/passport


Run in project folder:

$ php artisan passport:install

$ php artisan passport:client --personal


Default User Credentials

User email account available under 'Users' table 'email' column.

All seeded accounts use 'aspire@123' password as well

Postman Setup

Import Aspire_Loan_App.json file into Postman Collections

Configure postman environment variable as your application root path

Final Steps

Step 1: Configure 'Headers' to support 'JSON' response.

Step 2: Run Login API with respective valid username and password.

Step 3: Copy the response authorized token.

Step 4: To access loans API, Need to configure authorization 'Headers' with 'Bearer authorized-token'

Testing

Run `php artisan test` to execute feature test and unit test