rap2hpoutre/has-uuid 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

rap2hpoutre/has-uuid

Composer 安装命令:

composer require rap2hpoutre/has-uuid

包简介

Use both auto-increment and UUID

README 文档

README

What?

Why choose between Seq ID (aka auto-increment) and UUID when you can use both? This package helps you to add UUID to your Laravel Models.

You can also use this class if you only wants UUID without increments.

Quick start

Install with composer:

composer require rap2hpoutre/has-uuid

Add the trait to your models:

<?php
class User {
    
    use \Rap2hpoutre\HasUuid\HasUuid;
    
    // ...
}

Use the Trait to load your models:

$user = User::uuid('e3ae1e6b-fabb-4839-bf65-de9a892c0d56');

And when you save a model, it will magically add a UUID to it:

$user = new User;
$user->name = 'raph';
$user->save(); // <- Your user has now a UUID (and a ID if you have not removed it)

PS: don't forget to add the UUID in your migrations:

<?php   
   class CreateSesNotificationsTable extends \Illuminate\Database\Migrations\Migration
   {
       public function up()
       {
           \Schema::create('user', function ($table) {
               $table->increments('id');
               $table->uuid('uuid')->index(); // <- THIS.
               $table->string('email')->index();
               $table->timestamps();
           });
       }
       // ...
   }

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-10-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固