v1.2.0
Summary
Version 1.2.0 adds first‑class support for custom database table prefixes—allowing you to namespace all bkash tables via a new config option and accompanying migrations—and introduces a Laravel event (PaymentSuccessful) that fires after each successful payment, complete with configuration toggles and example listener scaffolding in the README. ([GitHub]1, [GitHub]2)
All stubs, models, and the service provider have been updated so that published migrations, runtime models, and configuration publishing now fully respect the new bkash.database.table_prefix setting. ([GitHub]1, [GitHub]1)
You can also migrate existing data from old tables to newly prefixed tables via a brand‑new update_bkash_tables_with_prefix migration stub. ([GitHub]1)
🚀 New Features
1. Custom Table Prefix Support
- Configurable prefix via
bkash.database.table_prefix(defaults tobkash_). ([GitHub]1) .envvariableBKASH_TABLE_PREFIXto override at deploy time. ([GitHub]1)- Updated migration stubs (
create_bkash_payments_table.php.stub,create_bkash_refunds_table.php.stub) to read the prefix from config and create/drop tables accordingly. ([GitHub]1) - New migration stub
update_bkash_tables_with_prefix.php.stubautomatically copies data from unprefixed tables into the newly prefixed tables when you runphp artisan migrate. ([GitHub]1) - Models
BkashPaymentandBkashRefundnow call$this->setTable($prefix . 'payments')/$this->setTable($prefix . 'refunds')in their constructors to respect the configured prefix at runtime. ([GitHub]1)
2. Event System for Successful Payments
PaymentSuccessfulevent dispatched insrc/Bkash.phpimmediately after a payment executes successfully (insideexecutePayment). ([GitHub]2)- New config section
events.payment_success(defaulttrue) to enable/disable firing this event. ([GitHub]2) - README updated with detailed instructions on how to listen for
Ihasan\Bkash\Events\PaymentSuccessfulin yourEventServiceProvider, plus an example listener class implementingShouldQueue. ([GitHub]2)
⚙️ Configuration Changes
config/bkash.php
'database' => [
'table_prefix' => env('BKASH_TABLE_PREFIX', 'bkash_'),
],
'events' => [
'payment_success' => env('BKASH_FIRE_PAYMENT_SUCCESS_EVENT', true),
],- Inserted under existing
default_intent/default_currencysettings. ([GitHub]1) - Environment variables documented in README. ([GitHub]1)
Publishing via Service Provider
BkashServiceProvider.php now publishes:
- The
config/bkash.phpfile under theconfigtag - All three migration stubs (
create_bkash_payments,create_bkash_refunds,update_bkash_tables_with_prefix) under themigrationstag ([GitHub]1)
🗄️ Database Migrations
-
create_bkash_payments_table.php.stub
-
create_bkash_refunds_table.php.stub
-
update_bkash_tables_with_prefix.php.stub
📦 Model Updates
BkashPayment(src/Models/BkashPayment.php): constructor sets table name dynamically. ([GitHub]1)BkashRefund(src/Models/BkashRefund.php): same prefix‑aware constructor. ([GitHub]1)
🔄 Backward‑Compatibility & Breaking Changes
- If you change the
table_prefixafter data exists, new prefixed tables are created; update any raw SQL queries in your app to reference the new names. ([GitHub]1) - Existing published migrations (v1.1.0) will not include the
update_bkash_tables_with_prefixstub—you must re‑publish migrations to get the new stub. ([GitHub]1)
Commits: