Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_KEY=base64:dGhpc2lzYWRlZmF1bHRrZXljaGFuZ2VtZTEyMzQ1
APP_DEBUG=true
APP_URL=http://localhost

Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Tests

on:
pull_request:
branches: [main, develop]
push:
branches: [main, develop]

jobs:
phpunit:
name: PHPUnit Tests
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: pdo_sqlite, mbstring, zip, gd, bcmath
coverage: none

- name: Cache Composer packages
uses: actions/cache@v4
with:
path: vendor
key: composer-${{ hashFiles('composer.lock') }}
restore-keys: composer-

- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist

- name: Copy .env
run: cp .env.example .env

- name: Generate app key
run: php artisan key:generate

- name: Run PHPUnit tests
run: php artisan test --parallel
env:
DB_CONNECTION: sqlite
DB_DATABASE: ':memory:'

code-style:
name: Code Style (Pint)
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.4'

- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist

- name: Run Pint
run: ./vendor/bin/pint --test
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Cooperative Bank Management System

[![Tests](https://github.com/vipul26singh/laravel-cooperative-bank/actions/workflows/tests.yml/badge.svg)](https://github.com/vipul26singh/laravel-cooperative-bank/actions/workflows/tests.yml)

A production-ready, open-source **core banking solution** purpose-built for cooperative banks, credit societies, and microfinance institutions. Manages the complete banking lifecycle — from customer onboarding and KYC verification through loan disbursement, EMI collection, fixed deposits, and financial reporting — all from a single web application.

Built with **Laravel 13** and deployable in one command via Docker. No banking software license fees. No vendor lock-in.
Expand Down Expand Up @@ -661,7 +663,7 @@ Planned improvements to make the system production-ready for real bank operation
- [ ] **Webhook support** for third-party integrations
- [x] **Mobile-responsive testing** — verify all pages work on tablets (common in bank branches)
- [x] **Accessibility audit** — ARIA labels, keyboard navigation, screen reader support
- [ ] **CI/CD pipeline** — GitHub Actions for automated testing on every push
- [x] **CI/CD pipeline** — GitHub Actions for automated testing on every push

---

Expand Down
34 changes: 28 additions & 6 deletions app/Http/Controllers/InstallController.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,16 +161,38 @@ public function run()
$dbPath = database_path('database.sqlite');
if (!file_exists($dbPath)) touch($dbPath);
}
// 2. Write .env (uses default key from .env.example so app can boot)
File::put(base_path('.env'), $env);
$steps[] = ['name' => 'Create .env configuration', 'status' => 'success'];

// 2. Generate app key
Artisan::call('key:generate', ['--force' => true]);
$steps[] = ['name' => 'Generate application encryption key', 'status' => 'success'];
// 3. Try to generate a fresh app key (replaces default key)
try {
Artisan::call('key:generate', ['--force' => true]);
$steps[] = ['name' => 'Generate application encryption key', 'status' => 'success'];
} catch (\Exception $e) {
$steps[] = ['name' => 'Generate application encryption key', 'status' => 'skipped', 'note' => 'Run php artisan key:generate manually'];
}

// 4. Set DB config at runtime so migrations work without reloading .env
$dbConn = $db['db_connection'] ?? 'sqlite';
config(["database.default" => $dbConn]);
if ($dbConn === 'sqlite') {
config(["database.connections.sqlite.database" => database_path('database.sqlite')]);
} else {
config([
"database.connections.{$dbConn}.host" => $db['db_host'] ?? '127.0.0.1',
"database.connections.{$dbConn}.port" => $db['db_port'] ?? '3306',
"database.connections.{$dbConn}.database" => $db['db_database'] ?? 'coopbank',
"database.connections.{$dbConn}.username" => $db['db_username'] ?? 'root',
"database.connections.{$dbConn}.password" => $db['db_password'] ?? '',
]);
}
DB::purge();
DB::reconnect();

// 3. Clear config cache
Artisan::call('config:clear');
$steps[] = ['name' => 'Clear configuration cache', 'status' => 'success'];
// Clear config cache
try { Artisan::call('config:clear'); } catch (\Exception $e) { /* may fail if no cache exists */ }
$steps[] = ['name' => 'Configure database connection', 'status' => 'success'];

// 4. Create storage symlink
try {
Expand Down
8 changes: 7 additions & 1 deletion resources/views/install/complete.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@
{{-- Post-install Commands --}}
<h6 class="fw-bold mb-2"><i class="fas fa-terminal me-1"></i> Post-Install (for standalone servers)</h6>
<table class="table table-sm table-bordered">
@if(collect(session('steps', []))->contains(fn($s) => $s['status'] === 'skipped' && str_contains($s['name'], 'encryption')))
<tr>
<td><strong class="text-danger">Generate App Key</strong><br><small class="text-muted">Default key was used. Generate a secure one for production.</small></td>
<td><pre class="bg-dark text-white p-2 rounded mb-0" style="font-size:0.78rem;">php artisan key:generate</pre></td>
</tr>
@endif
<tr>
<td><strong>Queue Worker</strong><br><small class="text-muted">Process background jobs (emails, notifications, audit)</small></td>
<td><pre class="bg-dark text-white p-2 rounded mb-0" style="font-size:0.78rem;">php artisan queue:work</pre></td>
Expand All @@ -52,7 +58,7 @@
<td><pre class="bg-dark text-white p-2 rounded mb-0" style="font-size:0.78rem;">* * * * * cd /path/to/project && php artisan schedule:run >> /dev/null 2>&1</pre></td>
</tr>
</table>
<small class="text-muted"><i class="fab fa-docker me-1"></i>If using Docker, both are already running automatically via Supervisor.</small>
<small class="text-muted"><i class="fab fa-docker me-1"></i>If using Docker, all of the above are handled automatically.</small>

<div class="text-center mt-4">
<a href="/login" class="btn btn-primary px-5"><i class="fas fa-sign-in-alt me-2"></i>Go to Login</a>
Expand Down
Loading