27 lines
546 B
PHP
27 lines
546 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class MediaPlay extends Model
|
|
{
|
|
protected $fillable = ['user_id', 'media_id', 'play_count', 'last_played_at'];
|
|
|
|
protected $casts = [
|
|
'play_count' => 'integer',
|
|
'last_played_at' => 'datetime',
|
|
];
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function media(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Media::class);
|
|
}
|
|
}
|