rasel9w9/dynamic-table-updater
## Getting Started
Install the package via Composer:
```bash
composer require rasel9w9/dynamic-table-updater
Publish the configuration (if needed) and register the service provider in config/app.php under providers. The package enables real-time table updates without page reloads.
First Use Case: Trigger dynamic updates via a Blade directive or JavaScript hook:
// In a controller or Blade file
@dynamicTableUpdate('users', ['id' => 1], ['name' => 'John Doe'])
Or via JavaScript:
DynamicTableUpdater.update('users', { id: 1 }, { name: 'John Doe' });
Use the @dynamicTableUpdate directive to bind table updates to form submissions or button clicks:
<form action="{{ route('update.user') }}" method="POST">
@dynamicTableUpdate('users', ['id' => $user->id], ['name' => $name])
<button type="submit">Update</button>
</form>
For SPAs or AJAX-heavy apps, use the JavaScript API:
// Listen for changes and auto-update
document.querySelector('#update-btn').addEventListener('click', () => {
DynamicTableUpdater.update('users', { id: 123 }, { status: 'active' });
});
Leverage Laravel events to trigger updates globally:
// In an EventServiceProvider
public function boot()
{
UserUpdated::listen(function ($user) {
DynamicTableUpdater::queueUpdate('users', $user->toArray());
});
}
table_updater middleware is registered in app/Http/Kernel.php if using API routes.config/dynamic-table-updater.php for rate-limiting or queue settings.'debug' => env('APP_DEBUG', false),
DynamicTableUpdater::updating event.DynamicTableUpdater::queueUpdate() for background processing:
DynamicTableUpdater::queueUpdate('posts', $postData, 'high');
DynamicTableUpdater::batchUpdate('orders', $orderIds, ['status' => 'shipped']);
**NO_UPDATE_NEEDED** for prior versions (this is the first assessment).
How can I help you explore Laravel packages today?