Downloads
Stars
Version
A helper to maintain Userstamps in Laravel. Easily add and maintain userstamps by adding a trait to your model.
$ composer require berthott/laravel-userstamps
php artisan make:model YourModel -m
$table->userstamps()
to your migration
SoftDeletes
trait on your model additionally add $table->softDeletesUserstamp()
HasUserstamps
trait to your newly generated model.\berthott\Userstamps\UserstampsServiceProvider::register()
creator()
, editor()
, and destroyer()
will be available for your convenience.You may change the column names by adding these constants to your model.
const CREATED_BY = 'alt_created_by';
const UPDATED_BY = 'alt_updated_by';
const DELETED_BY = 'alt_deleted_by';
Note that in this case you cannot use $table->userstamps()
but need to define the columns separately with
$table->unsignedBigInteger('alt_created_by')->nullable();
$table->unsignedBigInteger('alt_updated_by')->nullable();
$table->unsignedBigInteger('alt_deleted_by')->nullable();
Tested with Laravel 10.x.
Inspired by https://github.com/WildsideUK/Laravel-Userstamps and https://github.com/hrshadhin/laravel-userstamps.
See License File. Copyright © 2023 Jan Bladt.