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

conedevelopment / root / 13086943877

01 Feb 2025 08:35AM UTC coverage: 79.285% (+1.2%) from 78.037%
13086943877

push

github

web-flow
Merge pull request #234 from xHeaven/patch-1

Codebase health checkup

195 of 239 new or added lines in 45 files covered. (81.59%)

2 existing lines in 2 files now uncovered.

2572 of 3244 relevant lines covered (79.28%)

35.8 hits per line

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

11.11
/src/Fields/Dropdown.php
1
<?php
2

3
namespace Cone\Root\Fields;
4

5
use Closure;
6
use Illuminate\Database\Eloquent\Model;
7
use Illuminate\Http\Request;
8
use Illuminate\Support\Collection;
9
use Illuminate\Support\Facades\View;
10

11
class Dropdown extends Select
12
{
13
    /**
14
     * The Blade template.
15
     */
16
    protected string $template = 'root::fields.dropdown';
17

18
    /**
19
     * Create a new field instance.
20
     */
21
    public function __construct(string $label, Closure|string|null $modelAttribute = null)
22
    {
23
        parent::__construct($label, $modelAttribute);
1✔
24

25
        $this->class(['form-control', 'combobox__control']);
1✔
26
    }
27

28
    /**
29
     * {@inheritdoc}
30
     */
31
    public function toInput(Request $request, Model $model): array
32
    {
33
        $data = parent::toInput($request, $model);
×
34

35
        return array_merge($data, [
×
NEW
36
            'options' => array_map(static fn (array $option): array => array_merge($option, [
×
NEW
37
                'html' => View::make('root::fields.dropdown-option', $option)->render(),
×
NEW
38
            ]), $data['options']),
×
39
            'selection' => Collection::make($data['options'])
×
40
                ->filter(fn (array $option): bool => $option['selected'] ?? false)
×
NEW
41
                ->map(static fn (array $option): array => array_merge($option, [
×
NEW
42
                    'html' => View::make('root::fields.dropdown-option', $option)->render(),
×
NEW
43
                ]))
×
44
                ->values()
×
45
                ->all(),
×
46
            'config' => [
×
47
                'multiple' => $this->getAttribute('multiple'),
×
48
            ],
×
49
        ]);
×
50
    }
51
}
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

© 2025 Coveralls, Inc