1. [FEAT] 在 StaffCardLog 模型中新增 order 關聯,並在 StaffCardController 預載此關聯。 2. [STYLE] 優化員工識別使用紀錄的 UI 佈局,採用更具質感的顯示方式並使用 status-badge 組件。 3. [STYLE] 擴充 status-badge 組件,支援 verified 與 completed 狀態標籤。 4. [DOCS] 更新 zh_TW.json 語系檔,新增 Staff、Verified、Verified Only 等翻譯。
57 lines
1.1 KiB
PHP
57 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Traits\TenantScoped;
|
|
use App\Models\Machine\Machine;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class StaffCardLog extends Model
|
|
{
|
|
use TenantScoped;
|
|
|
|
public $timestamps = false;
|
|
|
|
protected $fillable = [
|
|
'company_id',
|
|
'staff_card_id',
|
|
'machine_id',
|
|
'payment_type',
|
|
'code_id',
|
|
'order_id',
|
|
'action',
|
|
'remark',
|
|
'raw_data',
|
|
];
|
|
|
|
protected $casts = [
|
|
'raw_data' => 'array',
|
|
'created_at' => 'datetime',
|
|
];
|
|
|
|
/**
|
|
* 取得關聯的員工卡片
|
|
*/
|
|
public function staffCard(): BelongsTo
|
|
{
|
|
return $this->belongsTo(StaffCard::class);
|
|
}
|
|
|
|
/**
|
|
* 取得刷卡的機台
|
|
*/
|
|
public function machine(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Machine::class);
|
|
}
|
|
|
|
/**
|
|
* 取得關聯的訂單
|
|
*/
|
|
public function order(): BelongsTo
|
|
{
|
|
return $this->belongsTo(\App\Models\Transaction\Order::class);
|
|
}
|
|
}
|