1. Go to this page and download the library: Download turahe/laravel-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/ */
turahe / laravel-userstamps example snippets
use Turahe\UserStamps\Concerns\HasUserStamps;
class Post extends Model
{
use HasUserStamps;
}
use Turahe\UserStamps\Concerns\HasCustomUserStamps;
class Post extends Model
{
use HasCustomUserStamps;
protected $userstampsConfig = [
'columns' => [
'created_by' => [
'type' => 'uuid',
'index' => true,
'comment' => 'User who created this post'
],
'updated_by' => [
'type' => 'uuid',
'nullable' => false
]
]
];
}
Schema::create('posts', function (Blueprint $table) {
$table->id();
$table->string('title');
$table->userstamps(); // Adds created_by and updated_by
$table->softUserstamps(); // Adds deleted_by
$table->timestamps();
$table->softDeletes();
});