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

conedevelopment / bazar / 12390198681

18 Dec 2024 09:35AM UTC coverage: 63.695% (-0.04%) from 63.736%
12390198681

push

github

iamgergo
wip

2 of 3 new or added lines in 2 files covered. (66.67%)

993 of 1559 relevant lines covered (63.69%)

15.75 hits per line

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

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

3
namespace Cone\Bazar\Resources;
4

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

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

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

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

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

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

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

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

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