74 lines
1.5 KiB
PHP
74 lines
1.5 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Created by Reliese Model.
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Database\Eloquent\Casts\Attribute;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
use Pgvector\Laravel\Vector;
|
|
|
|
/**
|
|
* Class BackgroundMedia
|
|
*
|
|
* @property int $id
|
|
* @property string $list_type
|
|
* @property string $area
|
|
* @property string $location_name
|
|
* @property string $status
|
|
* @property uuid|null $media_uuid
|
|
* @property string|null $media_url
|
|
* @property Vector|null $embedding
|
|
* @property Carbon|null $created_at
|
|
* @property Carbon|null $updated_at
|
|
* @property string|null $deleted_at
|
|
*/
|
|
class BackgroundMedia extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'background_medias';
|
|
|
|
protected $casts = [
|
|
'embedding' => Vector::class,
|
|
'media_width' => 'integer',
|
|
'media_height' => 'integer',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'status',
|
|
'media_uuid',
|
|
'media_url',
|
|
'embedding',
|
|
'prompt',
|
|
'media_width',
|
|
'media_height',
|
|
'aspect_ratio',
|
|
];
|
|
|
|
protected $hidden = [
|
|
'id',
|
|
'created_at',
|
|
'updated_at',
|
|
'deleted_at',
|
|
'status',
|
|
'media_uuid',
|
|
'embedding',
|
|
];
|
|
|
|
protected $appends = [
|
|
'ids',
|
|
];
|
|
|
|
protected function ids(): Attribute
|
|
{
|
|
return Attribute::make(
|
|
get: fn ($value, $attributes) => hashids_encode($attributes['id']),
|
|
);
|
|
}
|
|
}
|