37 lines
707 B
PHP
37 lines
707 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
|
||
|
|
class MediaDownload extends Model
|
||
|
|
{
|
||
|
|
public const CREATED_AT = 'created_at';
|
||
|
|
|
||
|
|
public const UPDATED_AT = null;
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'media_id',
|
||
|
|
'user_id',
|
||
|
|
'downloaded_at',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected function casts(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'downloaded_at' => 'datetime',
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function media(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(\Spatie\MediaLibrary\MediaCollections\Models\Media::class);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function user(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(User::class);
|
||
|
|
}
|
||
|
|
}
|