intitial work on rest api

This commit is contained in:
Nabeel Shahzad
2017-08-14 18:26:20 -05:00
parent e19b84a078
commit bc94772ce2
10 changed files with 179 additions and 11 deletions

View File

@@ -0,0 +1,21 @@
<?php
namespace App\Models\Traits;
use Webpatser\Uuid\Uuid;
trait Uuids
{
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
$key = $model->getKeyName();
if (empty($model->{$key})) {
$model->{$key} = Uuid::generate()->string;
}
#$model->{$model->getKeyName()} = Uuid::generate()->string;
});
}
}