LaravelPackages.net
Acme Inc.
Toggle sidebar
tobidsn/laravel-userstamps

A simple Laravel package for Eloquent Model user specific feilds.

18
1
v5.0.1
About tobidsn/laravel-userstamps

tobidsn/laravel-userstamps is a Laravel package for a simple laravel package for eloquent model user specific feilds.. It currently has 1 GitHub stars and 18 downloads on Packagist (latest version v5.0.1). Install it with composer require tobidsn/laravel-userstamps. Discover more Laravel packages by tobidsn or browse all Laravel packages to compare alternatives.

Last updated

Laravel Userstamps

Laravel Userstamps is a simple Laravel package for your Eloquent Model user specific feilds. This package automatically inserts/updates an user id on your table on who created, last updated and deleted the record.

Install

  1. Add repositories in composer.json
"repositories": [
   {
     "url": "https://github.com/tobidsn/laravel-userstamps.git",

      "type": "git"
    }
 ],
  1. Add the package name in require with the branch name after the dev:
"tobidsn/laravel-userstamps": "dev-master"

Usage

Update your model's migration and add created_by, updated_by and deleted_by field using the userstamps() blueprint macro.

Schema::create('users', function (Blueprint $table) {
    $table->increments('id');
    $table->string('name', 100);
    $table->userstamps();
    $table->timestamps();
});

Then use UserstampsTrait on your model.

namespace App;

use Tobidsn\Userstamps\UserstampsTrait;

class User extends Model
{
    use UserstampsTrait;
}

Dropping columns

You can drop auditable columns using dropUserstamps() method.

Schema::create('users', function (Blueprint $table) {
    $table->dropUserstamps();
});

Original : https://github.com/hrshadhin/laravel-userstamps

And your done!

License

The MIT License (MIT). Please see License File for more information.

Star History Chart