From 706b4d43f6d9b19be2aacb9d47882e1c7cb943ca Mon Sep 17 00:00:00 2001 From: Franck DAKIA Date: Sun, 20 Apr 2025 23:27:15 +0000 Subject: [PATCH 1/5] refactor: rename frontent folder to assets --- {frontend => assets}/js/Example.jsx | 0 {frontend => assets}/js/Example.vue | 0 {frontend => assets}/js/app.js | 0 {frontend => assets}/sass/_variables.scss | 0 {frontend => assets}/sass/app.scss | 0 config/app.php | 4 ++-- public/index.php | 4 ++-- vite.config.js | 10 +++++----- 8 files changed, 9 insertions(+), 9 deletions(-) rename {frontend => assets}/js/Example.jsx (100%) rename {frontend => assets}/js/Example.vue (100%) rename {frontend => assets}/js/app.js (100%) rename {frontend => assets}/sass/_variables.scss (100%) rename {frontend => assets}/sass/app.scss (100%) diff --git a/frontend/js/Example.jsx b/assets/js/Example.jsx similarity index 100% rename from frontend/js/Example.jsx rename to assets/js/Example.jsx diff --git a/frontend/js/Example.vue b/assets/js/Example.vue similarity index 100% rename from frontend/js/Example.vue rename to assets/js/Example.vue diff --git a/frontend/js/app.js b/assets/js/app.js similarity index 100% rename from frontend/js/app.js rename to assets/js/app.js diff --git a/frontend/sass/_variables.scss b/assets/sass/_variables.scss similarity index 100% rename from frontend/sass/_variables.scss rename to assets/sass/_variables.scss diff --git a/frontend/sass/app.scss b/assets/sass/app.scss similarity index 100% rename from frontend/sass/app.scss rename to assets/sass/app.scss diff --git a/config/app.php b/config/app.php index 15237eaf..b9664045 100644 --- a/config/app.php +++ b/config/app.php @@ -30,9 +30,9 @@ 'env_file' => realpath(__DIR__ . '/../.env.json'), /** - * Path to the frontend folder + * Path to the assets folder */ - 'frontend_path' => dirname(__DIR__) . '/frontend', + 'frontend_path' => dirname(__DIR__) . '/assets', /** * Path to the seeders folder diff --git a/public/index.php b/public/index.php index 3a6a2a6e..859aa871 100644 --- a/public/index.php +++ b/public/index.php @@ -20,11 +20,11 @@ // Bind kernel to application $app->bind( - Kernel::configure(realpath(__DIR__ . '/../config')) + Kernel::configure(base_path('config')) ); // Load application routing -require __DIR__ . "/../routes/app.php"; +require base_path('routes/app.php'); // Run The Application $app->send(); diff --git a/vite.config.js b/vite.config.js index edf10bd9..aa13fde7 100644 --- a/vite.config.js +++ b/vite.config.js @@ -6,13 +6,13 @@ import tailwindcss from "@tailwindcss/vite"; export default defineConfig({ plugins: [react(), vue(), tailwindcss()], - root: path.resolve(__dirname, 'frontend'), + root: path.resolve(__dirname, 'assets'), build: { outDir: path.resolve(__dirname, 'public'), emptyOutDir: true, rollupOptions: { input: { - app: path.resolve(__dirname, 'frontend/js/app.js') + app: path.resolve(__dirname, 'assets/js/app.js') }, output: { entryFileNames: 'js/[name].js', @@ -31,7 +31,7 @@ export default defineConfig({ css: { preprocessorOptions: { scss: { - additionalData: `@import "${path.resolve(__dirname, 'frontend/sass/variables.scss')}";` + additionalData: `@import "${path.resolve(__dirname, 'assets/sass/variables.scss')}";` }, less: { javascriptEnabled: true @@ -40,8 +40,8 @@ export default defineConfig({ }, resolve: { alias: { - '@': path.resolve(__dirname, 'frontend/js'), - '@sass': path.resolve(__dirname, 'frontend/sass') + '@': path.resolve(__dirname, 'assets/js'), + '@sass': path.resolve(__dirname, 'assets/sass') } }, server: { From bc4c703eaecd383cd4e4150de5bea2773fc9b8ba Mon Sep 17 00:00:00 2001 From: Franck DAKIA Date: Mon, 21 Apr 2025 14:20:25 +0000 Subject: [PATCH 2/5] code formatting --- app/Kernel.php | 15 +++++++++++++++ bow | 2 +- public/index.php | 5 +---- routes/app.php | 2 +- routes/console.php | 13 +++++++------ 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/app/Kernel.php b/app/Kernel.php index ca159214..9a0e59f9 100644 --- a/app/Kernel.php +++ b/app/Kernel.php @@ -2,6 +2,7 @@ namespace App; +use Bow\Router\Router; use Bow\Configuration\Loader as ApplicationLoader; class Kernel extends ApplicationLoader @@ -102,6 +103,20 @@ public function boot(): ApplicationLoader { parent::boot(); + $this->routes(); + return $this; } + + /** + * Load the define route + * + * @return void + */ + public function routes(): void + { + $router = Router::getInstance(); + + require base_path('routes/app.php'); + } } diff --git a/bow b/bow index 25aea726..7cd2e229 100755 --- a/bow +++ b/bow @@ -31,7 +31,7 @@ $setting->setServiceDirectory(__DIR__.'/app/Services'); $setting->setEventDirectory(__DIR__.'/app/Events'); $setting->setEventListenerDirectory(__DIR__.'/app/Listeners'); $setting->setSeederDirectory(__DIR__.'/seeders'); -$setting->setComponentDirectory(__DIR__.'/frontend'); +$setting->setComponentDirectory(__DIR__.'/assets'); $setting->setConfigDirectory(__DIR__.'/config'); $setting->setPublicDirectory(__DIR__.'/public'); $setting->setProducerDirectory(__DIR__.'/app/Producers'); diff --git a/public/index.php b/public/index.php index 859aa871..218334ba 100644 --- a/public/index.php +++ b/public/index.php @@ -23,8 +23,5 @@ Kernel::configure(base_path('config')) ); -// Load application routing -require base_path('routes/app.php'); - // Run The Application -$app->send(); +$app->run(); diff --git a/routes/app.php b/routes/app.php index f7357c02..d40657fb 100644 --- a/routes/app.php +++ b/routes/app.php @@ -2,4 +2,4 @@ use App\Controllers\WelcomeController; -$app->get('/', WelcomeController::class)->name('app.index'); +$router->get('/', WelcomeController::class)->name('app.index'); diff --git a/routes/console.php b/routes/console.php index 585e17e3..26dff233 100644 --- a/routes/console.php +++ b/routes/console.php @@ -2,10 +2,11 @@ use Bow\Console\Color; use Bow\Console\Argument; +use App\Commands\TestCommand; -$console->addCommand( - 'hello', - function (Argument $argument) { - echo Color::green("hello, bow task runner."); - } -); +$console->addCommand('hello', function (Argument $argument) { + $index = route('app.index'); + echo Color::green("hello, bow task runner."); +}); + +$console->addCommand('test:hello', TestCommand::class); From 5f4170f98af7ef3aa884914bacbb27d93469a9e1 Mon Sep 17 00:00:00 2001 From: Franck DAKIA Date: Tue, 9 Dec 2025 14:20:42 +0000 Subject: [PATCH 3/5] Update method name --- app/Controllers/Controller.php | 2 +- config/database.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Controllers/Controller.php b/app/Controllers/Controller.php index 8b0176e0..2c7e96c9 100644 --- a/app/Controllers/Controller.php +++ b/app/Controllers/Controller.php @@ -93,7 +93,7 @@ public function config(?string $key = null, mixed $setting = null) * @param ?callable $cb * @return Database */ - public function db(?string $name = null, ?callable $cb = null) + public function app_db(?string $name = null, ?callable $cb = null) { return call_user_func_array('db', func_get_args()); } diff --git a/config/database.php b/config/database.php index 209e667a..5cc45eac 100644 --- a/config/database.php +++ b/config/database.php @@ -23,7 +23,7 @@ * automatically. So you absolutely must not edit the default key. * * In the opposite box you must execute the code in each route. - * `db('the key name')` or `Bow\Database\Database::connection('the key name')` + * `app_db('the key name')` or `Bow\Database\Database::connection('the key name')` */ 'connections' => [ /** From c1f734e94c621ea585605103b42b90d1d2a6cdb6 Mon Sep 17 00:00:00 2001 From: Franck DAKIA Date: Sat, 20 Dec 2025 18:07:43 +0000 Subject: [PATCH 4/5] Add new seeder concept --- app/Controllers/Controller.php | 8 ++++---- app/Kernel.php | 8 +++++--- bow | 4 ++-- config/storage.php | 8 ++++++-- seeders/20251220174703-user-seeder.php | 25 ++++++++++++++++++++++++ seeders/_database.php | 7 ------- seeders/users.php | 27 -------------------------- templates/layouts/default.tintin.php | 6 +++--- 8 files changed, 45 insertions(+), 48 deletions(-) create mode 100644 seeders/20251220174703-user-seeder.php delete mode 100644 seeders/_database.php delete mode 100644 seeders/users.php diff --git a/app/Controllers/Controller.php b/app/Controllers/Controller.php index 2c7e96c9..55331e02 100644 --- a/app/Controllers/Controller.php +++ b/app/Controllers/Controller.php @@ -7,7 +7,7 @@ use Bow\Database\Database; use Bow\Validation\Validate; use Bow\Validation\Validator; -use Bow\Queue\ProducerService; +use Bow\Queue\Worker; use Bow\Contracts\ResponseInterface; use Bow\Configuration\Loader as Config; use Bow\Database\QueryBuilder; @@ -17,12 +17,12 @@ class Controller /** * Push the producer on queue list * - * @param ProducerService $producer + * @param Worker $producer * @return mixed */ - public function queue(ProducerService $producer) + public function queue(Worker $worker) { - queue($producer); + queue($worker); } /** diff --git a/app/Kernel.php b/app/Kernel.php index 9a0e59f9..3c44ab7e 100644 --- a/app/Kernel.php +++ b/app/Kernel.php @@ -37,7 +37,7 @@ public function namespaces(): array 'event' => 'App\\Events', 'listener' => 'App\\Listeners', 'exception' => 'App\\Exceptions', - 'producer' => 'App\\Producers', + 'job' => 'App\\Jobs', 'command' => 'App\\Commands', 'messaging' => 'App\\Messages', ]; @@ -115,8 +115,10 @@ public function boot(): ApplicationLoader */ public function routes(): void { + global $router; + $router = Router::getInstance(); - - require base_path('routes/app.php'); + + require_once base_path('routes/app.php'); } } diff --git a/bow b/bow index 7cd2e229..14d8417f 100755 --- a/bow +++ b/bow @@ -34,7 +34,7 @@ $setting->setSeederDirectory(__DIR__.'/seeders'); $setting->setComponentDirectory(__DIR__.'/assets'); $setting->setConfigDirectory(__DIR__.'/config'); $setting->setPublicDirectory(__DIR__.'/public'); -$setting->setProducerDirectory(__DIR__.'/app/Producers'); +$setting->setJobDirectory(__DIR__.'/app/Jobs'); $setting->setCommandDirectory(__DIR__.'/app/Commands'); $setting->setMessagingDirectory(__DIR__.'/app/Messages'); @@ -50,7 +50,7 @@ $console->bind($kernel); // Load the custom command application if (file_exists(__DIR__.'/routes/console.php')) { - require __DIR__.'/routes/console.php'; + require_once __DIR__.'/routes/console.php'; } // Start console diff --git a/config/storage.php b/config/storage.php index 61d31437..b3ed31c4 100644 --- a/config/storage.php +++ b/config/storage.php @@ -37,16 +37,20 @@ /** * S3 configuration + * Supports both AWS S3 and MinIO (S3-compatible storage) */ 's3' => [ 'driver' => 's3', 'bucket' => app_env('S3_BUCKET', 'settlements'), - 'region' => app_env('AWS_REGION'), + 'region' => app_env('AWS_REGION', 'us-east-1'), 'version' => 'latest', 'credentials' => [ 'key' => app_env('AWS_KEY'), 'secret' => app_env('AWS_SECRET'), ], - ] + // MinIO configuration (optional) + 'endpoint' => app_env('AWS_ENDPOINT'), // e.g., 'http://localhost:9000' for MinIO + 'use_path_style_endpoint' => app_env('AWS_USE_PATH_STYLE_ENDPOINT', false), // Set to true for MinIO + ], ], ]; diff --git a/seeders/20251220174703-user-seeder.php b/seeders/20251220174703-user-seeder.php new file mode 100644 index 00000000..2f558869 --- /dev/null +++ b/seeders/20251220174703-user-seeder.php @@ -0,0 +1,25 @@ + $faker->name, + 'description' => $faker->text(100), + 'email' => $faker->email, + 'password' => app_hash('password'), + 'created_at' => date('Y-m-d H:i:s'), + 'updated_at' => date('Y-m-d H:i:s'), + ]; + + User::create($user); + } + } +} diff --git a/seeders/_database.php b/seeders/_database.php deleted file mode 100644 index 953a9ad3..00000000 --- a/seeders/_database.php +++ /dev/null @@ -1,7 +0,0 @@ - $faker->name, - 'description' => $faker->text, - 'email' => $faker->email, - 'password' => app_hash('password'), - 'created_at' => date('Y-m-d H:i:s'), - 'updated_at' => date('Y-m-d H:i:s'), - ]; -} - -return [User::class => $seeds]; diff --git a/templates/layouts/default.tintin.php b/templates/layouts/default.tintin.php index 6f58b540..941c8f62 100644 --- a/templates/layouts/default.tintin.php +++ b/templates/layouts/default.tintin.php @@ -100,8 +100,8 @@ -
- %inject('content') -
+
+ %inject('content') +
From 36de3b25eac42d08d5e06c8839d10e89bf0010be Mon Sep 17 00:00:00 2001 From: Franck DAKIA Date: Sat, 20 Dec 2025 20:40:33 +0000 Subject: [PATCH 5/5] Fix class names --- app/Controllers/Controller.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Controllers/Controller.php b/app/Controllers/Controller.php index 55331e02..da2e7404 100644 --- a/app/Controllers/Controller.php +++ b/app/Controllers/Controller.php @@ -7,7 +7,7 @@ use Bow\Database\Database; use Bow\Validation\Validate; use Bow\Validation\Validator; -use Bow\Queue\Worker; +use Bow\Queue\QueueJob; use Bow\Contracts\ResponseInterface; use Bow\Configuration\Loader as Config; use Bow\Database\QueryBuilder; @@ -17,12 +17,12 @@ class Controller /** * Push the producer on queue list * - * @param Worker $producer + * @param QueueJob $job * @return mixed */ - public function queue(Worker $worker) + public function queue(QueueJob $job) { - queue($worker); + queue($job); } /**