mirror of
https://github.com/danog/psalm-plugin-laravel.git
synced 2024-11-30 04:39:01 +01:00
23 lines
441 B
PHP
23 lines
441 B
PHP
<?php
|
|
|
|
namespace Tests\Psalm\LaravelPlugin\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Support\Str;
|
|
use Ramsey\Uuid\UuidInterface;
|
|
|
|
/**
|
|
* @property-read UuidInterface $uuid
|
|
*/
|
|
abstract class AbstractUuidModel extends Model
|
|
{
|
|
protected static function boot()
|
|
{
|
|
parent::boot();
|
|
|
|
static::creating(function (Model $model) {
|
|
$model->setAttribute('uuid', Str::uuid());
|
|
});
|
|
}
|
|
}
|