21. Accessor 까지
This commit is contained in:
parent
c6edbf93dd
commit
a26047d608
@ -26,4 +26,14 @@ class StockLog extends Model
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(Product::class);
|
return $this->belongsTo(Product::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getChangeTypeLabelAttribute(): string
|
||||||
|
{
|
||||||
|
return $this->change_type === 'in' ? '입고' : '출고';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getSignedAmountAttribute(): int
|
||||||
|
{
|
||||||
|
return $this->change_type === 'in' ? (int) $this->change_amount : -(int) $this->change_amount;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,7 +51,7 @@
|
|||||||
<td>{{ $product->id }}</td>
|
<td>{{ $product->id }}</td>
|
||||||
<td>{{ $product->name }}</td>
|
<td>{{ $product->name }}</td>
|
||||||
<td>{{ $product->sku }}</td>
|
<td>{{ $product->sku }}</td>
|
||||||
<td>{{ number_format($product->quantity) }} 개</td>
|
<td>{{ number_format($product->quantity) }}</td>
|
||||||
<td>{{ number_format($product->price) }} 원</td>
|
<td>{{ number_format($product->price) }} 원</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group btn-group-sm" role="group">
|
<div class="btn-group btn-group-sm" role="group">
|
||||||
|
|||||||
@ -22,8 +22,8 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{{ $log->created_at->format('Y-m-d H:i') }}</td>
|
<td>{{ $log->created_at->format('Y-m-d H:i') }}</td>
|
||||||
<td>{{ ($log->product?->name ?? '삭제된 상품') }} ({{ $log->product?->sku ?? '-'}})</td>
|
<td>{{ ($log->product?->name ?? '삭제된 상품') }} ({{ $log->product?->sku ?? '-'}})</td>
|
||||||
<td>{{ $log->change_type }}</td>
|
<td>{{ $log->change_type_label }}</td>
|
||||||
<td>{{ $log->change_amount }} 개</td>
|
<td>{{ $log->signed_amount }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
@endforeach
|
@endforeach
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user