Initial commit: Animexe Laravel platform
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class VoiceCall extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'caller_id', 'callee_id', 'channel_name', 'status', 'answered_at', 'ended_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'answered_at' => 'datetime',
|
||||
'ended_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function caller(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'caller_id');
|
||||
}
|
||||
|
||||
public function callee(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'callee_id');
|
||||
}
|
||||
|
||||
public function isActive(): bool
|
||||
{
|
||||
return in_array($this->status, ['ringing', 'active']);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user