Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
45.45% |
5 / 11 |
|
14.29% |
1 / 7 |
CRAP | |
0.00% |
0 / 1 |
| CommissionAdjustment | |
45.45% |
5 / 11 |
|
14.29% |
1 / 7 |
14.95 | |
0.00% |
0 / 1 |
| casts | |
100.00% |
5 / 5 |
|
100.00% |
1 / 1 |
1 | |||
| influencer | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| commission | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| order | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| settlement | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| creator | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| approver | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Models; |
| 4 | |
| 5 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
| 6 | use Illuminate\Database\Eloquent\Model; |
| 7 | use Illuminate\Database\Eloquent\Relations\BelongsTo; |
| 8 | |
| 9 | class CommissionAdjustment extends Model |
| 10 | { |
| 11 | use HasFactory; |
| 12 | |
| 13 | protected $fillable = [ |
| 14 | 'tenant_id', 'store_id', 'influencer_id', 'commission_id', 'order_id', 'settlement_id', |
| 15 | 'type', 'amount', 'reason', 'created_by', 'approved_by', 'approved_at', 'metadata', |
| 16 | ]; |
| 17 | |
| 18 | protected function casts(): array |
| 19 | { |
| 20 | return [ |
| 21 | 'amount' => 'decimal:2', |
| 22 | 'approved_at' => 'datetime', |
| 23 | 'metadata' => 'array', |
| 24 | ]; |
| 25 | } |
| 26 | |
| 27 | public function influencer(): BelongsTo { return $this->belongsTo(Influencer::class); } |
| 28 | public function commission(): BelongsTo { return $this->belongsTo(Commission::class); } |
| 29 | public function order(): BelongsTo { return $this->belongsTo(Order::class); } |
| 30 | public function settlement(): BelongsTo { return $this->belongsTo(MonthlySettlement::class, 'settlement_id'); } |
| 31 | public function creator(): BelongsTo { return $this->belongsTo(User::class, 'created_by'); } |
| 32 | public function approver(): BelongsTo { return $this->belongsTo(User::class, 'approved_by'); } |
| 33 | } |