Files
backend/app/Models/CallHistory.php
2025-05-07 15:08:36 +03:30

27 lines
637 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class CallHistory extends Model
{
use HasFactory;
protected $guarded = [];
public static function recordHistory(Call $call, $event_id): void
{
$event = Event::query()->where('id', $event_id)->first();
self::query()->create([
'call_id' => $call->id,
'telephone_id' => $call->telephone_id,
'caller_phone_number' => $call->caller_phone_number,
'event_id' => $event->id,
'event_name' => $event->name
]);
}
}