定制 mazyvan/userstamps 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mazyvan/userstamps

Composer 安装命令:

composer require mazyvan/userstamps

包简介

A fork from WildSide. Eloquent trait to automatically maintain created_by and updated_by (and deleted_by when using SoftDeletes) on your models

README 文档

README

MAYBE UNSTABLE. READ BELOW

Warning: This is a fork from WildSideUK/Laravel-Userstamps that doesn't fire the laravel "update" events on deletions. It's only purpouse is for the Virtuamx team to work with this lib while the WildSideUK team check for the issue 23. If they approve the pull request. This fork will be deprecated.

Stability Important Note: I have experienced issues with this plugin using Passport. This issue is reported here -> mattiverse#17 So I tried the solution of setting manually the 'web' guard. This plugin also have that workaround.
I think you should not have problems unless you use different models for your 'web' and 'api' logins. That's my thoughts.

Provides an Eloquent trait to automatically maintain created_by and updated_by (and deleted_by when using SoftDeletes) on your models.

Requirements

  • This package requires PHP 5.6+
  • It works with Laravel 5.x (and may work with earlier versions too).

Installation

Require this package with composer

composer require mazyvan/userstamps

Migrate your Model's table to include a created_by and updated_by (and deleted_by if using SoftDeletes).

$table -> unsignedInteger('created_by') -> nullable() -> default(null) -> after('created_at');
$table -> unsignedInteger('updated_by') -> nullable() -> default(null) -> after('updated_at');

Load the trait in your Model.

use Mazyvan\Userstamps\Userstamps;

class Example extends Model {

    use Userstamps;
}

The following methods become available on your models to help retrieve the users creating, updating and deleting (if using SoftDeletes).

$model -> creator; // the user who created the model
$model -> editor; // the user who last updated the model
$model -> destroyer; // the user who deleted the model

If you want to manually set the created_by or updated_by properties on your model you can stop Userstamps being automatically maintained using the stopUserstamping method.

If you want to define the created_by, updated_by, or deleted_by column names, add the following class constants to your model(s).

const CREATED_BY = 'created_by';
const UPDATED_BY = 'updated_by';
const DELETED_BY = 'deleted_by';

License

This open-source software is licensed under the MIT license.

统计信息

  • 总下载量: 156
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 69
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-09-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固