datakrama / eloquid
Eloquid - Auto UUID for Eloquent Model
Installs: 4 220
Dependents: 1
Suggesters: 0
Security: 0
Stars: 5
Watchers: 1
Forks: 6
Open Issues: 1
Requires
- php: ^7.3|^8.0
- illuminate/support: ^8.0
Requires (Dev)
- laravel/legacy-factories: ^1.0.4
- orchestra/testbench: ^6.0
- phpunit/phpunit: ^8.0|^9.0
README
This package is created to insert UUID into Eloquent Model Primary Key (id) automatically.
Requirement
Laravel Compatibility
Installation
$ composer require datakrama/eloquid:"^2.0"
Usages
Reguler model
<?php namespace App; use Illuminate\Database\Eloquent\Model; use Datakrama\Eloquid\Traits\Uuids; class Role extends Model { use Uuids; /** * The users that belong to the role. */ public function users() { return $this->belongsToMany('App\User')->using('App\RoleUser'); } }
Custom intermediate table model (Pivot)
<?php namespace App; use Illuminate\Database\Eloquent\Relations\Pivot; use Datakrama\Eloquid\Traits\Uuids; class RoleUser extends Pivot { use Uuids; // }
Licence
The MIT License (MIT). Please see License File for more information.