danielemontecchi/laravel-userstamps
created_by, updated_by, and deleted_by fields.where clauses to filter by user stamps (e.g., Model::whereCreatedBy($user)).deleted_at handling (may conflict with Laravel’s soft deletes if not configured).creating, updating events).auth()->user()) for non-web requests.created_by, updated_by, deleted_by columns to existing tables may require downtime.created_by/updated_by fields in tables? If so, how will conflicts be resolved?updated_at, ip_address) required beyond user stamps?spatie/laravel-activitylog).created_by/updated_by fields.ALTER TABLE users ADD COLUMN created_by_id INT;
ALTER TABLE users ADD COLUMN updated_by_id INT;
ALTER TABLE users ADD COLUMN deleted_by_id INT;
php artisan vendor:publish --provider="DanieleMontecchi\Userstamps\UserstampsServiceProvider"
Update config/userstamps.php for field names/ignored models.use DanieleMontecchi\Userstamps\Userstamps;
class User extends Model {
use Userstamps;
}
User, Post).creating, updating), soft deletes (if configured).retrieved/saved events.Log, Setting).Order, User).created_by_id columns).fillable/accessors for stamp fields.config/userstamps.php.eloquent.* events for stamp-related issues.try-catch in event listeners).created_by_id, updated_by_id for query performance.
ALTER TABLE posts ADD INDEX idx_created_by (created_by_id);
Auth::loginUsingId() in jobs).| Failure Scenario | Impact | Mitigation |
|---|---|---|
| User context lost in queued job | Stamps set to NULL |
Pass user ID explicitly or use Auth::setUser(). |
| Database migration fails | Missing stamp columns | Backfill data or roll back. |
| Package conflicts with observers | Overridden stamp logic | Disable package for specific models. |
| High write load | Event listener lag | Batch inserts or use database triggers. |
| Soft deletes + package interaction | deleted_by not set |
Configure shouldDelete in Userstamps trait. |
creating, updating, deleted events.Userstamps modifies queries globally.auth()->user() is available in all contexts.Post::whereCreatedBy($user)).How can I help you explore Laravel packages today?