This commit is contained in:
ct
2025-06-19 22:24:47 +08:00
parent 5d3a3c8818
commit 7712101b76
11 changed files with 489 additions and 22 deletions

View File

@@ -35,17 +35,19 @@ class BackgroundMedia extends Model
protected $casts = [
'embedding' => Vector::class,
'media_width' => 'integer',
'media_height' => 'integer',
];
protected $fillable = [
'list_type',
'area',
'location_name',
'status',
'media_uuid',
'media_url',
'embedding',
'prompt',
'media_width',
'media_height',
'aspect_ratio',
];
protected $hidden = [
@@ -53,9 +55,6 @@ class BackgroundMedia extends Model
'created_at',
'updated_at',
'deleted_at',
'list_type',
'area',
'location_name',
'status',
'media_uuid',
'embedding',
@@ -68,7 +67,7 @@ class BackgroundMedia extends Model
protected function ids(): Attribute
{
return Attribute::make(
get: fn ($value, $attributes) => hashids_encode($attributes['id']),
get: fn($value, $attributes) => hashids_encode($attributes['id']),
);
}
}

78
app/Models/Meme.php Normal file
View File

@@ -0,0 +1,78 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Spatie\Tags\HasTags;
/**
* Class Meme
*
* @property int $id
* @property string $type
* @property int|null $category_id
* @property int|null $user_id
* @property int|null $meme_id
* @property int|null $background_id
* @property string $status
* @property string $prompt
* @property string|null $caption
* @property string|null $meme_keywords
* @property string|null $background
* @property string $keywords
* @property Carbon|null $created_at
* @property Carbon|null $updated_at
* @property string|null $deleted_at
*
* @package App\Models
*/
class Meme extends Model
{
use SoftDeletes, HasTags;
protected $table = 'memes';
protected $casts = [
'is_system' => 'boolean',
'category_id' => 'int',
'user_id' => 'int',
'meme_id' => 'int',
'background_id' => 'int',
'meme_keywords' => 'array',
'keywords' => 'array',
];
protected $fillable = [
'type',
'is_system',
'category_id',
'user_id',
'meme_id',
'background_id',
'status',
'prompt',
'caption',
'meme_keywords',
'background',
'keywords'
];
public function meme_media()
{
return $this->hasOne(MemeMedia::class, 'id', 'meme_id');
}
public function background_media()
{
return $this->hasOne(BackgroundMedia::class, 'id', 'background_id');
}
}