-
-
Save gclove/397012a31730341dd98f17f649b1439e to your computer and use it in GitHub Desktop.
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 characters
| <?php | |
| namespace App\Traits; | |
| use Illuminate\Support\Str; | |
| trait UsesUuid | |
| { | |
| /** | |
| * Get the route key for the model. | |
| * | |
| * @return string | |
| */ | |
| public function getRouteKeyName() | |
| { | |
| return 'uuid'; | |
| } | |
| protected static function bootUsesUuid() | |
| { | |
| static::creating(function ($model) { | |
| $model->uuid = Str::orderedUuid(); | |
| }); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment