dereffi/issuing
Composer 安装命令:
composer require dereffi/issuing
包简介
PHP package built for Laravel 5.* to save creator last updator and deletor in database tables
README 文档
README
DerEffi/laravel-issuing is a PHP package built for Laravel 5.* to save creator last updator and deletor in database tables
VERSIONS
This package is Laravel 5.8 compliant. Currentl Package version 0.1.0
ABOUT
- Easy add the columns
created_by,updated_byanddeleted_byin the migration files - Auto storing the data in mentioned columns on eloquent events
- Auto adding relationships on the selected models
- Easy customization over the config file
INSTALLATION
This project can be installed via Composer. To get the latest version of the Issuing Package run the following command:
composer require dereffi/issuing
After the installation you can run following command to publish the config file
php artisan vendor:publish --tag=dereffi-issuing
Usage
CONFIGURATION
The model representing the Issuer must implement the authenticatable
interface Illuminate\Contracts\Auth\Authenticatable (or any child of it)
which is the default with the Eloquent User model.
Easy Configuration of the Issuer Model and the database column in the config file issuing.php
Migrations
To auto create the *_by columns to migration tables you have to call the IssuerColumns class
anywhere in the Schema::create function with the $table as parameter.
The names of the columns can be changed in the config/issuing.php file. If you do so
you have to refresh the migration or do it bevor you migrate your tables.
Following exaple with the default laravel users migration file:
<?php
use Dereffi\Issuing\IssuerColumns; // <-- Import
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUsersTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
IssuerColumns::create($table); // <-- auto adding the columns
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}
Models
To auto save the issuer id with the element on creating, updationg or deleting you have to use
the Dereffi\Issuing\Issuable Trait in the model files like the following example with the default laravel
User Model:
<?php
namespace App;
use Dereffi\Issuing\Issuable; // <-- add this line to Import the Trait
use Illuminate\Notifications\Notifiable;
use Illuminate\Contracts\Auth\MustVerifyEmail;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable, Issuable; // <-- add the Issuable Trait to the Model
LICENSE
Laravel User Verification is licensed under The MIT License (MIT).
dereffi/issuing 适用场景与选型建议
dereffi/issuing 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 06 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 dereffi/issuing 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dereffi/issuing 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-06-19