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

conedevelopment / bazar / 20312681017

17 Dec 2025 06:08PM UTC coverage: 63.972% (-0.4%) from 64.395%
20312681017

push

github

iamgergo
wip

2 of 6 new or added lines in 1 file covered. (33.33%)

5 existing lines in 2 files now uncovered.

1092 of 1707 relevant lines covered (63.97%)

18.06 hits per line

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

83.87
/src/Resources/OrderResource.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Cone\Bazar\Resources;
6

7
use Cone\Bazar\Actions\SendOrderDetails;
8
use Cone\Bazar\Bazar;
9
use Cone\Bazar\Fields\Items;
10
use Cone\Bazar\Fields\OrderStatus;
11
use Cone\Bazar\Fields\Transactions;
12
use Cone\Bazar\Models\Order;
13
use Cone\Bazar\Widgets\OrdersCount;
14
use Cone\Root\Fields\BelongsTo;
15
use Cone\Root\Fields\Date;
16
use Cone\Root\Fields\ID;
17
use Cone\Root\Fields\Select;
18
use Cone\Root\Fields\Text;
19
use Cone\Root\Resources\Resource;
20
use Illuminate\Http\Request;
21

22
class OrderResource extends Resource
23
{
24
    /**
25
     * The model class.
26
     */
27
    protected string $model = Order::class;
28

29
    /**
30
     * The group for the resource.
31
     */
32
    protected string $group = 'Shop';
33

34
    /**
35
     * The relations to eager load on every query.
36
     */
37
    protected array $with = [
38
        'user',
39
    ];
40

41
    /**
42
     * Get the model for the resource.
43
     */
44
    public function getModel(): string
45
    {
46
        return $this->model::getProxiedClass();
70✔
47
    }
48

49
    /**
50
     * Define the fields.
51
     */
52
    public function fields(Request $request): array
53
    {
54
        return [
70✔
55
            ID::make(),
70✔
56

57
            BelongsTo::make(__('Customer'), 'user')
70✔
58
                ->display('name')
70✔
59
                ->sortable(column: 'name'),
70✔
60

61
            Text::make(__('Total'), static function (Request $request, Order $model): string {
70✔
62
                return $model->formattedTotal;
×
63
            }),
70✔
64

65
            Select::make(__('Currency'), 'currency')
70✔
66
                ->options(static function (Request $request, Order $model): array {
70✔
NEW
67
                    return array_merge(
×
NEW
68
                        array_column(Bazar::getCurrencies(), 'name', 'value'),
×
NEW
69
                        [$model->currency->value => $model->currency->name]
×
NEW
70
                    );
×
71
                })
70✔
72
                ->hiddenOn(['index']),
70✔
73

74
            OrderStatus::make(),
70✔
75

76
            Date::make(__('Created At'), 'created_at')
70✔
77
                ->withTime()
70✔
78
                ->hiddenOn(['edit', 'create'])
70✔
79
                ->sortable(),
70✔
80

81
            Items::make(),
70✔
82

83
            Transactions::make(),
70✔
84
        ];
70✔
85
    }
86

87
    /**
88
     * {@inheritdoc}
89
     */
90
    public function actions(Request $request): array
91
    {
92
        return [
70✔
93
            new SendOrderDetails,
70✔
94
        ];
70✔
95
    }
96

97
    /**
98
     * {@inheritdoc}
99
     */
100
    public function widgets(Request $request): array
101
    {
102
        return [
70✔
103
            new OrdersCount,
70✔
104
        ];
70✔
105
    }
106
}
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