60 lines
1.3 KiB
PHP
60 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class Transaction extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
public const STATUS_TRUE_POSITIVE = 'true_positive';
|
|
public const STATUS_FALSE_POSITIVE = 'false_positive';
|
|
public const STATUS_CLEARED = 'cleared';
|
|
|
|
/**
|
|
* @var array<int, string>
|
|
*/
|
|
protected $fillable = [
|
|
'company_id',
|
|
'reference',
|
|
'amount',
|
|
'currency',
|
|
'counterparty',
|
|
'counterparty_country',
|
|
'channel',
|
|
'executed_at',
|
|
'risk_score',
|
|
'status',
|
|
'requires_review',
|
|
'flagged_by',
|
|
'flagged_reason',
|
|
'signals',
|
|
];
|
|
|
|
/**
|
|
* @var array<string, string>
|
|
*/
|
|
protected $casts = [
|
|
'executed_at' => 'datetime',
|
|
'requires_review' => 'boolean',
|
|
'signals' => 'array',
|
|
];
|
|
|
|
public function company(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Company::class);
|
|
}
|
|
|
|
public function statusLabel(): string
|
|
{
|
|
return match ($this->status) {
|
|
self::STATUS_TRUE_POSITIVE => __('Bestätigter Treffer'),
|
|
self::STATUS_FALSE_POSITIVE => __('Fehlalarm'),
|
|
default => __('Freigegeben'),
|
|
};
|
|
}
|
|
}
|