Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
83.33% |
10 / 12 |
|
71.43% |
5 / 7 |
CRAP | |
0.00% |
0 / 1 |
| PaymentRecord | |
83.33% |
10 / 12 |
|
71.43% |
5 / 7 |
7.23 | |
0.00% |
0 / 1 |
| casts | |
100.00% |
6 / 6 |
|
100.00% |
1 / 1 |
1 | |||
| influencer | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| tenant | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| store | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| paidBy | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| settlement | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| item | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Models; |
| 4 | |
| 5 | use App\Enums\PaymentStatus; |
| 6 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
| 7 | use Illuminate\Database\Eloquent\Model; |
| 8 | use Illuminate\Database\Eloquent\Relations\BelongsTo; |
| 9 | |
| 10 | class PaymentRecord extends Model |
| 11 | { |
| 12 | use HasFactory; |
| 13 | |
| 14 | protected $fillable = [ |
| 15 | 'tenant_id', 'store_id', 'influencer_id', 'settlement_id', 'settlement_item_id', |
| 16 | 'amount', 'status', 'pix_key', 'paid_at', 'paid_by', 'reference', 'notes', 'metadata', |
| 17 | ]; |
| 18 | |
| 19 | protected function casts(): array |
| 20 | { |
| 21 | return [ |
| 22 | 'amount' => 'decimal:2', |
| 23 | 'status' => PaymentStatus::class, |
| 24 | 'paid_at' => 'datetime', |
| 25 | 'metadata' => 'array', |
| 26 | ]; |
| 27 | } |
| 28 | |
| 29 | public function influencer(): BelongsTo { return $this->belongsTo(Influencer::class); } |
| 30 | public function tenant(): BelongsTo { return $this->belongsTo(Tenant::class); } |
| 31 | public function store(): BelongsTo { return $this->belongsTo(Store::class); } |
| 32 | public function paidBy(): BelongsTo { return $this->belongsTo(User::class, 'paid_by'); } |
| 33 | public function settlement(): BelongsTo { return $this->belongsTo(MonthlySettlement::class, 'settlement_id'); } |
| 34 | public function item(): BelongsTo { return $this->belongsTo(SettlementItem::class, 'settlement_item_id'); } |
| 35 | } |