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

conedevelopment / bazar / 20694116184

04 Jan 2026 02:08PM UTC coverage: 68.615% (+4.5%) from 64.117%
20694116184

push

github

iamgergo
version

1679 of 2447 relevant lines covered (68.61%)

25.06 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
101✔
32
    {
33
        return $this->model::getProxiedClass();
101✔
34
    }
35

36
    /**
37
     * {@inheritdoc}
38
     */
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
101✔
48
    {
49
        return [
101✔
50
            ID::make(),
101✔
51

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

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

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