mirror of
https://github.com/tiennm99/coolify.git
synced 2026-08-20 02:27:57 +00:00
Authorize cloud provider token access, audit sensitive operations, and standardize public IDs across deployment and resource flows.
36 lines
788 B
PHP
36 lines
788 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
abstract class BaseModel extends Model
|
|
{
|
|
protected static function boot()
|
|
{
|
|
parent::boot();
|
|
|
|
static::creating(function (Model $model) {
|
|
// Generate a UUID if one isn't set
|
|
if (! $model->uuid) {
|
|
$model->uuid = new_public_id();
|
|
}
|
|
});
|
|
}
|
|
|
|
public function sanitizedName(): Attribute
|
|
{
|
|
return new Attribute(
|
|
get: fn () => sanitize_string($this->getRawOriginal('name')),
|
|
);
|
|
}
|
|
|
|
public function image(): Attribute
|
|
{
|
|
return new Attribute(
|
|
get: fn () => sanitize_string($this->getRawOriginal('image')),
|
|
);
|
|
}
|
|
}
|