Deploy Ladill Meet / deploy (push) Successful in 54s
Wallet debits at session end, on recording/file storage, and via daily renewals with grace period before asset deletion. Co-authored-by: Cursor <cursoragent@cursor.com>
59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Models\Concerns\BelongsToOwner;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Support\Str;
|
|
|
|
class Recording extends Model
|
|
{
|
|
use BelongsToOwner;
|
|
|
|
protected $table = 'meet_recordings';
|
|
|
|
protected $fillable = [
|
|
'uuid', 'owner_ref', 'session_id', 'status', 'layout', 'storage_path',
|
|
'thumbnail_path', 'file_size', 'duration_seconds', 'started_by_ref',
|
|
'started_at', 'ended_at', 'failure_reason', 'metadata',
|
|
'storage_paid_until', 'storage_grace_ends_at', 'storage_last_billed_at',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'started_at' => 'datetime',
|
|
'ended_at' => 'datetime',
|
|
'storage_paid_until' => 'datetime',
|
|
'storage_grace_ends_at' => 'datetime',
|
|
'storage_last_billed_at' => 'datetime',
|
|
'metadata' => 'array',
|
|
];
|
|
}
|
|
|
|
protected static function booted(): void
|
|
{
|
|
static::creating(function (Recording $recording) {
|
|
if (empty($recording->uuid)) {
|
|
$recording->uuid = (string) Str::uuid();
|
|
}
|
|
});
|
|
}
|
|
|
|
public function getRouteKeyName(): string
|
|
{
|
|
return 'uuid';
|
|
}
|
|
|
|
public function session(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Session::class, 'session_id');
|
|
}
|
|
|
|
public function isReady(): bool
|
|
{
|
|
return $this->status === 'ready';
|
|
}
|
|
}
|