added attchments
This commit is contained in:
70
app/Models/Attachment.php
Normal file
70
app/Models/Attachment.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int|null $thread_id
|
||||
* @property int|null $post_id
|
||||
* @property int|null $attachment_extension_id
|
||||
* @property int|null $attachment_group_id
|
||||
* @property int|null $user_id
|
||||
* @property string $disk
|
||||
* @property string $path
|
||||
* @property string $original_name
|
||||
* @property string|null $extension
|
||||
* @property string $mime_type
|
||||
* @property int $size_bytes
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Attachment extends Model
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'thread_id',
|
||||
'post_id',
|
||||
'attachment_extension_id',
|
||||
'attachment_group_id',
|
||||
'user_id',
|
||||
'disk',
|
||||
'path',
|
||||
'original_name',
|
||||
'extension',
|
||||
'mime_type',
|
||||
'size_bytes',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'size_bytes' => 'int',
|
||||
];
|
||||
|
||||
public function thread(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Thread::class);
|
||||
}
|
||||
|
||||
public function post(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Post::class);
|
||||
}
|
||||
|
||||
public function extension(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(AttachmentExtension::class, 'attachment_extension_id');
|
||||
}
|
||||
|
||||
public function group(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(AttachmentGroup::class, 'attachment_group_id');
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user