Files
memefast/app/Models/TrackingSave.php
2025-07-16 15:49:30 +08:00

64 lines
1.3 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class TrackingSave extends Model
{
use HasFactory;
protected $table = 'track_saves';
protected $fillable = [
'device_id',
'user_agent',
'ip_address',
'platform',
'meme_id',
'meme_media_id',
'background_media_id',
'caption_texts',
'is_premium_export',
'action_at',
];
protected $casts = [
'caption_texts' => 'array',
'is_premium_export' => 'boolean',
'action_at' => 'datetime',
'created_at' => 'datetime',
'updated_at' => 'datetime',
];
protected $attributes = [
'platform' => 'web',
'is_premium_export' => false,
];
/**
* Get the related meme
*/
public function meme()
{
return $this->belongsTo(Meme::class, 'meme_id');
}
/**
* Get the related meme media
*/
public function memeMedia()
{
return $this->belongsTo(MemeMedia::class, 'meme_media_id');
}
/**
* Get the related background media
*/
public function backgroundMedia()
{
return $this->belongsTo(BackgroundMedia::class, 'background_media_id');
}
}