Skip to content

Commit

Permalink
chore: add install routes
Browse files Browse the repository at this point in the history
  • Loading branch information
im-machakata committed Mar 27, 2024
1 parent ec480d2 commit f4452b3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions app/Config/Routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
use App\Controllers\PettyCash;
use App\Controllers\Requisition;
use App\Controllers\TravelAndSubsistencies;
use App\Models\Account;
use CodeIgniter\Router\RouteCollection;

/**
Expand Down Expand Up @@ -55,3 +56,23 @@
'filter' => 'auth'
]);
});

$routes->group('sys', function (RouteCollection $routes) {
$routes->get('install', function () {
command('migrate');
if (!model(Account::class)->first()) {
command('db:seed Accounts');
}
return redirect()->to('/');
});
$routes->get('re-install', function () {
command('migrate:rollback --force --all');
command('db:seed Accounts');
command('migrate');
return redirect()->to('/');
});
$routes->get('crash-it', function () {
command('migrate:rollback --force --all');
return redirect()->to('/');
});
});

0 comments on commit f4452b3

Please sign in to comment.