• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

conedevelopment / bazar / 20248285521

15 Dec 2025 09:37PM UTC coverage: 61.163% (-2.3%) from 63.48%
20248285521

Pull #235

github

web-flow
Merge c10e94de1 into 090ff8496
Pull Request #235: Coupons & Discounts

58 of 144 new or added lines in 18 files covered. (40.28%)

14 existing lines in 3 files now uncovered.

989 of 1617 relevant lines covered (61.16%)

14.83 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Models/AppliedCoupon.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Cone\Bazar\Models;
6

7
use Cone\Bazar\Interfaces\Models\AppliedCoupon as Contract;
8
use Cone\Root\Traits\InteractsWithProxy;
9
use Illuminate\Database\Eloquent\Casts\Attribute;
10
use Illuminate\Database\Eloquent\Relations\MorphPivot;
11

12
class AppliedCoupon extends MorphPivot implements Contract
13
{
14
    use InteractsWithProxy;
15

16
    /**
17
     * The attributes that should have default values.
18
     *
19
     * @var array<string, mixed>
20
     */
21
    protected $attributes = [
22
        'value' => 0,
23
    ];
24

25
    /**
26
     * The attributes that are mass assignable.
27
     *
28
     * @var list<string>
29
     */
30
    protected $fillable = [
31
        'value',
32
    ];
33

34
    /**
35
     * The table associated with the model.
36
     *
37
     * @var string
38
     */
39
    protected $table = 'bazar_couponables';
40

41
    /**
42
     * Get the proxied interface.
43
     */
44
    public static function getProxiedInterface(): string
45
    {
NEW
46
        return Contract::class;
×
47
    }
48

49
    /**
50
     * {@inheritdoc}
51
     */
52
    public function casts(): array
53
    {
NEW
54
        return [
×
NEW
55
            'value' => 'float',
×
NEW
56
        ];
×
57
    }
58

59
    /**
60
     * Get the formatted value attribute.
61
     */
62
    protected function formattedValue(): Attribute
63
    {
NEW
64
        return new Attribute(
×
NEW
65
            get: fn (): string => $this->format()
×
NEW
66
        );
×
67
    }
68

69
    /**
70
     * Get the formatted coupon value.
71
     */
72
    public function format(): string
73
    {
NEW
74
        return $this->pivotParent?->checkoutable?->getCurrency()?->format($this->value) ?: '';
×
75
    }
76
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc