Created
July 22, 2017 19:17
Revisions
-
kicco created this gist
Jul 22, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,19 @@ <?php namespace App; use Ramsey\Uuid\Uuid; trait HasPrimaryUUID { protected static function boot() { parent::boot(); static::creating(function ($model) { $model->{$model->getKeyName()} = Uuid::uuid4()->toString(); }); } }