- PMIS 모델 21개 + DailyWorkLog 2개에 $connection = 'codebridge' 추가 - MNG 마이그레이션 파일 18개 전체 삭제 (API에서 관리) - 원칙: MNG는 마이그레이션 파일을 생성하지 않고 API에서만 관리
39 lines
844 B
PHP
39 lines
844 B
PHP
<?php
|
|
|
|
namespace App\Models\Juil;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class PmisNoticeAttachment extends Model
|
|
{
|
|
protected $connection = 'codebridge';
|
|
|
|
protected $fillable = [
|
|
'notice_id',
|
|
'original_name',
|
|
'file_path',
|
|
'file_size',
|
|
];
|
|
|
|
public function notice(): BelongsTo
|
|
{
|
|
return $this->belongsTo(PmisNotice::class, 'notice_id');
|
|
}
|
|
|
|
public static function formatSize(int $bytes): string
|
|
{
|
|
if ($bytes >= 1073741824) {
|
|
return round($bytes / 1073741824, 1).' G';
|
|
}
|
|
if ($bytes >= 1048576) {
|
|
return round($bytes / 1048576, 1).' M';
|
|
}
|
|
if ($bytes >= 1024) {
|
|
return round($bytes / 1024, 1).' K';
|
|
}
|
|
|
|
return $bytes.' B';
|
|
}
|
|
}
|