https://github.com/xzxzyzyz/laravel-uuid-model
This package allows you to easily work with UUIDs in your Laravel models
https://github.com/xzxzyzyz/laravel-uuid-model
eloquent laravel model uuid
Last synced: 4 months ago
JSON representation
This package allows you to easily work with UUIDs in your Laravel models
- Host: GitHub
- URL: https://github.com/xzxzyzyz/laravel-uuid-model
- Owner: xzxzyzyz
- License: mit
- Created: 2018-10-04T06:53:42.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-04-01T08:04:20.000Z (over 1 year ago)
- Last Synced: 2025-03-04T03:51:14.806Z (4 months ago)
- Topics: eloquent, laravel, model, uuid
- Language: PHP
- Homepage:
- Size: 20.5 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel Uuid Model
[](https://travis-ci.com/xzxzyzyz/laravel-uuid-model)
[](https://packagist.org/packages/xzxzyzyz/laravel-uuid-model)
[](https://packagist.org/packages/xzxzyzyz/laravel-uuid-model)Using `uuid` in eloquent model.
## Installation
```bash
composer require xzxzyzyz/laravel-uuid-model
```## Usage
Create primary key as string type.
```php
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('example', function(Blueprint $table) {
$table->uuid('id')->primary();
// ...
});
}
```And, Extends `Xzxzyzyz\Laravel\Uuid\Model` in your model.
```php
use Xzxzyzyz\Laravel\Uuid\Model;class Example extends Model
{
//...
}
```