46 lines
895 B
PHP
46 lines
895 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class MessageAttachment extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
public $timestamps = false;
|
|
|
|
protected $fillable = [
|
|
'message_id',
|
|
'user_id',
|
|
'type',
|
|
'mime',
|
|
'size_bytes',
|
|
'width',
|
|
'height',
|
|
'sha256',
|
|
'original_name',
|
|
'storage_path',
|
|
'created_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'size_bytes' => 'integer',
|
|
'width' => 'integer',
|
|
'height' => 'integer',
|
|
'created_at' => 'datetime',
|
|
];
|
|
|
|
public function message(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Message::class);
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
}
|