Implement file upload and viewing functionality; refactor letter migrations and models to use UUIDs

This commit is contained in:
NoBody313
2025-03-23 03:29:49 +07:00
parent ed7509b2d5
commit ade38e2745
11 changed files with 544 additions and 47 deletions
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class FileUpload extends Model
{
use HasFactory, HasUuids;
protected $table = 'file_uploads';
protected $keyType = 'string';
public $incrementing = false;
protected $fillable = ['letter_id', 'file_name', 'file_path', 'mime_type'];
protected static function boot()
{
parent::boot();
static::creating(function ($model) {
$model->id = Str::uuid()->toString();
});
}
}