psalm-plugin-laravel/tests/Models/AbstractUuidModel.php
2021-07-07 00:31:40 +02:00

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());
});
}
}