janyksteenbeek/laravel-uuidable

This package is abandoned and no longer maintained. No replacement package was suggested.

Adding the ability to use UUIDs as identifiers on models in Laravel

1.0 2022-05-05 23:12 UTC

This package is not auto-updated.

Last update: 2023-02-19 14:28:02 UTC


README

Adding the ability to use UUIDs as identifiers on models in Laravel

Installation

You can install the package using Composer:

composer require janyksteenbeek/laravel-uuidable

Usage

Apply the trait supplied by this package to the model that needs a UUID as primary identifier.

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Janyk\LaravelUuidable\Uuidable;

class Post extends Model
{
    use Uuidable, HasFactory;
    // ...

Migrations

Note that you have to change your database migrations when using UUIDs. The identifying field needs to be a uuid field like in the following example:

    public function up()
    {
        Schema::create('posts', function (Blueprint $table) {
            $table->uuid('id')->primary();
    // ...

License

This package is open-source licensed under the MIT license set out in the LICENSE file

Security Vulnerabilities

This packages adheres the Responsible Disclosure guidelines set out by Webmethod regarding security vulnerabilities. You can find the policy here.