v7.0.0-beta.4 release
This commit is contained in:
1 parent
05db17887d
commit
1db039ff34
1545 files changed
+136783
-11634
No files matched your search
@@ -76,7 +76,9 @@ class ProductImage extends Model
|
||||
];
|
||||
|
||||
/**
|
||||
* 상품 관계
|
||||
* 이 이미지가 속한 상품 관계 (product_id FK).
|
||||
*
|
||||
* @return BelongsTo 상품 관계
|
||||
*/
|
||||
public function product(): BelongsTo
|
||||
{
|
||||
@@ -84,7 +86,9 @@ class ProductImage extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* 업로더 관계
|
||||
* 이 이미지를 업로드한 사용자 관계 (created_by FK).
|
||||
*
|
||||
* @return BelongsTo 업로더 사용자 관계
|
||||
*/
|
||||
public function creator(): BelongsTo
|
||||
{
|
||||
@@ -92,9 +96,10 @@ class ProductImage extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* 현재 로케일의 대체 텍스트 반환
|
||||
* 현재 로케일의 대체 텍스트(alt)를 반환합니다 (다국어 fallback chain 적용).
|
||||
*
|
||||
* @param string|null $locale 로케일
|
||||
* @param string|null $locale 반환할 로케일. null 이면 현재 앱 로케일 사용
|
||||
* @return string|null 로케일별 alt 텍스트, alt_text 가 비어있으면 null
|
||||
*/
|
||||
public function getLocalizedAltText(?string $locale = null): ?string
|
||||
{
|
||||
@@ -105,13 +110,14 @@ class ProductImage extends Model
|
||||
$locale = $locale ?? app()->getLocale();
|
||||
$altText = $this->alt_text;
|
||||
|
||||
return $altText[$locale] ?? $altText['ko'] ?? null;
|
||||
return $altText[$locale] ?? $altText[config('app.fallback_locale', 'ko')] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 컬렉션별 스코프
|
||||
* 특정 컬렉션(main/gallery/detail 등) 의 이미지만 필터링하는 쿼리 스코프.
|
||||
*
|
||||
* @param \Illuminate\Database\Eloquent\Builder $query
|
||||
* @param ProductImageCollection $collection 필터링할 이미지 컬렉션 enum
|
||||
* @return \Illuminate\Database\Eloquent\Builder
|
||||
*/
|
||||
public function scopeByCollection($query, ProductImageCollection $collection)
|
||||
@@ -131,7 +137,9 @@ class ProductImage extends Model
|
||||
}
|
||||
|
||||
/**
|
||||
* 다운로드 URL 반환 (API 서빙 URL)
|
||||
* `download_url` 가상 attribute — hash 기반 상품 이미지 서빙 API URL.
|
||||
*
|
||||
* @return string `/api/modules/sirsoft-ecommerce/product-image/{hash}` 형식 URL
|
||||
*/
|
||||
public function getDownloadUrlAttribute(): string
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user