Skip to content

Error with assignRole when I pass a string. #2329

Answered by erikn69
DesKevinMendez asked this question in Q&A
Discussion options

You must be logged in to vote

is Trait HasUuid like this uuid?

<?php
  namespace App;

  use Facades\Str;

  trait UuidTrait
  {
      public static function bootUuidTrait()
      {
          static::creating(function ($model) {
              $model->keyType = 'string';
              $model->incrementing = false;

              $model->{$model->getKeyName()} = $model->{$model->getKeyName()} ?: (string) Str::orderedUuid();
          });
      }
      
      public function getIncrementing()
      {
          return false;
      }
      
      public function getKeyType()
      {
          return 'string';
      }
  }

Replies: 3 comments 7 replies

Comment options

You must be logged in to vote
3 replies
@DesKevinMendez
Comment options

@erikn69
Comment options

@DesKevinMendez
Comment options

Comment options

You must be logged in to vote
4 replies
@erikn69
Comment options

@DesKevinMendez
Comment options

@erikn69
Comment options

@DesKevinMendez
Comment options

Answer selected by DesKevinMendez
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants