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

conedevelopment / bazar / 20693245827

04 Jan 2026 12:57PM UTC coverage: 66.667% (+2.6%) from 64.117%
20693245827

Pull #236

github

web-flow
Merge 790b9166d into f6c84deae
Pull Request #236: Discount Rules

212 of 311 new or added lines in 18 files covered. (68.17%)

105 existing lines in 40 files now uncovered.

1626 of 2439 relevant lines covered (66.67%)

18.59 hits per line

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

87.5
/src/Resources/TaxRateResource.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Cone\Bazar\Resources;
6

7
use Cone\Bazar\Models\TaxRate;
8
use Cone\Root\Fields\Boolean;
9
use Cone\Root\Fields\ID;
10
use Cone\Root\Fields\Number;
11
use Cone\Root\Fields\Text;
12
use Cone\Root\Resources\Resource;
13
use Illuminate\Database\Eloquent\Model;
14
use Illuminate\Http\Request;
15

16
class TaxRateResource extends Resource
17
{
18
    /**
19
     * The model class.
20
     */
21
    protected string $model = TaxRate::class;
22

23
    /**
24
     * The group for the resource.
25
     */
26
    protected string $group = 'Shop';
27

28
    /**
29
     * Get the model for the resource.
30
     */
31
    public function getModel(): string
70✔
32
    {
33
        return $this->model::getProxiedClass();
70✔
34
    }
35

36
    /**
37
     * {@inheritdoc}
38
     */
UNCOV
39
    public function modelTitle(Model $model): string
×
40
    {
41
        return sprintf('%s (%s)', $model->name, $model->formattedValue);
×
42
    }
43

44
    /**
45
     * Define the fields.
46
     */
47
    public function fields(Request $request): array
70✔
48
    {
49
        return [
70✔
50
            ID::make(),
70✔
51

52
            Text::make(__('Name'), 'name')
70✔
53
                ->rules(['required', 'string', 'max:256'])
70✔
54
                ->searchable()
70✔
55
                ->sortable()
70✔
56
                ->required(),
70✔
57

58
            Number::make(__('Rate'), 'value')
70✔
59
                ->required()
70✔
60
                ->rules(['required', 'numeric', 'min:0'])
70✔
61
                ->step(0.1)
70✔
62
                ->min(0)
70✔
63
                ->suffix('%')
70✔
64
                ->format(static function (Request $request, Model $model): string {
70✔
65
                    return $model->formattedValue;
×
66
                }),
70✔
67

68
            Boolean::make(__('Shipping'), 'shipping')
70✔
69
                ->help(__('If the box is checked, the tax rate is applied for the shipping costs.')),
70✔
70
        ];
70✔
71
    }
72
}
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