Coder Social home page Coder Social logo

laravel-uuid's Introduction

laravel-uuid

Eloquent UUID Trait for Laravel 5.7 and above.

โš ๏ธ This package will no longer be maintained. The HasUuids feature has been added in Laravel 9.

Github Actions Total Downloads MIT licensed

The HasUuid Trait will add behavior to creating and saving Eloquent events for generate an Uuid.

Installation

composer require jamesh/laravel-uuid

Usage

In your migrations

Schema::create('users', function (Blueprint $table) {
    $table->uuid('id')->primary(); // Create CHAR(36)
    $table->string('name');
    $table->string('email')->unique();
    $table->timestamp('email_verified_at')->nullable();
    $table->string('password');
    $table->rememberToken();
    $table->timestamps();
});

In your models

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Jamesh\Uuid\HasUuid;

class User extends Model
{
    use HasUuid;
}

Unit tests

To run the tests, just run composer install and composer test.

laravel-uuid's People

Contributors

jameshemery avatar masterix21 avatar nikans avatar osteel avatar peterschade avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

laravel-uuid's Issues

PHP 8 Support Issue

Please add support for PHP 8.

I'm unable to install this package.

PHP version: PHP 8.0.0 (cli)
OS : macOS Big sure 11.0.1

Error:

[InvalidArgumentException]
Package jamesh/laravel-uuid has a PHP requirement incompatible with your PHP version, PHP extensions and Composer version

Quick thanks

This is not an issue, just a quick thank you as this package is exactly what I was looking for. I have been using my own trait for quite some time and thought I should make a package out of it instead of copying it over from project to project again and again.

Thought I'd make a quick search for something similar before putting my own out there and ended up finding yours, which does exactly the same thing, even a bit better.

I don't understand why similar projects using inheritance instead of a trait seem to have more success - this is clearly not an inheritance situation, a trait is definitely the way to go in my opinion.

Just thought you'd like to know your work hasn't gone unnoticed!

Cheers

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.