1. Go to this page and download the library: Download kseven/userstamps library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use KSeven\Userstamps\Traits\Userstamps;
class User extends Model {
use Userstamps;
}
use KSeven\Userstamps\Traits\Userstamps;
class User extends Model {
use Userstamps;
const CREATED_BY = 'alt_created_by';
const UPDATED_BY = 'alt_updated_by';
const DELETED_BY = 'alt_deleted_by';
}
$model->creator; // usuário que criou o model
$model->editor; // usuário que atualizou por último o model
$model->destroyer; // usuário que excluiu o model
$model->stopUserstamping(); // para a atualização dos userstamps no model
$model->startUserstamping(); // retoma a atualização dos userstamps no model
use KSeven\Userstamps\Userstamps;
Userstamps::resolveUsing(
fn () => auth()->user()->customUserIdResolutionMethod()
);