Skip to content

Commit

Permalink
fix styleci
Browse files Browse the repository at this point in the history
  • Loading branch information
riipandi committed Jan 24, 2020
1 parent a833a42 commit 1de558f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Traits/HasUlidKey.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ public static function bootHasUlidKey()
{
static::creating(function ($model) {
$ulidFieldName = $model->getUlidFieldName();
if (empty($model->$ulidFieldName)) {
$model->$ulidFieldName = self::generateUlid();
if (empty($model->{$ulidFieldName})) {
$model->{$ulidFieldName} = self::generateUlid();
}
});
}
Expand All @@ -23,11 +23,6 @@ public function getUlidFieldName()
return 'ulid';
}

protected static function generateUlid()
{
return (string) \Ulid\Ulid::generate();
}

public function scopeByUlid($query, $ulid)
{
return $query->where($this->getUlidFieldName(), $ulid);
Expand All @@ -37,4 +32,9 @@ public static function findByUlid($ulid)
{
return static::byUlid($ulid)->first();
}

protected static function generateUlid()
{
return (string) \Ulid\Ulid::generate();
}
}

0 comments on commit 1de558f

Please sign in to comment.