feat(attachments): add AttachmentType enum and update Attachment model to use it
This commit is contained in:
13
app/Domains/Attachable/Enums/AttachmentType.php
Normal file
13
app/Domains/Attachable/Enums/AttachmentType.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domains\Attachable\Enums;
|
||||
|
||||
enum AttachmentType: string
|
||||
{
|
||||
case Image = 'image';
|
||||
case Video = 'video';
|
||||
case Pdf = 'pdf';
|
||||
case Document = 'document';
|
||||
case Audio = 'audio';
|
||||
case Other = 'other';
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Domains\Attachable\Models;
|
||||
|
||||
use App\Domains\Attachable\Enums\AttachmentType;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -35,6 +36,7 @@ class Attachment extends Model
|
||||
{
|
||||
return [
|
||||
'attachable_id' => 'integer',
|
||||
'type' => AttachmentType::class,
|
||||
'size' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user