25 خطوط
935 B
PHP
25 خطوط
935 B
PHP
<?php
|
|
|
|
namespace App\Modules\Learner\Domain;
|
|
|
|
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class LearningEvent extends Model
|
|
{
|
|
use HasUlids;
|
|
|
|
protected $fillable = ['organization_id', 'learner_id', 'client_event_id', 'event_type', 'schema_version', 'session_id', 'correlation_id', 'causation_id', 'device_context', 'assignment_id', 'course_version_id', 'lesson_id', 'block_id', 'payload', 'occurred_at', 'received_at'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return ['payload' => 'array', 'device_context' => 'array', 'occurred_at' => 'immutable_datetime', 'received_at' => 'immutable_datetime'];
|
|
}
|
|
|
|
protected static function booted(): void
|
|
{
|
|
static::updating(fn () => throw new \DomainException('Raw learning events are immutable.'));
|
|
static::deleting(fn () => throw new \DomainException('Raw learning events are immutable.'));
|
|
}
|
|
}
|