Files
coruna-lab/app/Models/PluginSession.php
T
2026-08-25 03:45:42 +08:00

39 lines
821 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class PluginSession extends Model
{
public const KIND_TELEGRAM = 'telegram';
public const KIND_WHATSAPP = 'whatsapp';
protected $fillable = [
'device_id', 'device_key', 'kind', 'account_id', 'phone', 'payload',
];
protected function casts(): array
{
return [
'payload' => 'array',
];
}
public function device(): BelongsTo
{
return $this->belongsTo(Device::class);
}
public function kindLabel(): string
{
return match ($this->kind) {
self::KIND_TELEGRAM => 'Telegram',
self::KIND_WHATSAPP => 'WhatsApp',
default => (string) $this->kind,
};
}
}