37 lines
688 B
PHP
37 lines
688 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class LessonProgress extends Model
|
|
{
|
|
protected $table = 'lesson_progress';
|
|
|
|
protected $fillable = [
|
|
'user_id',
|
|
'lesson_id',
|
|
'last_position_seconds',
|
|
'watched_percentage',
|
|
'completed_at',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'completed_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function lesson(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Lesson::class);
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|