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

conedevelopment / root / 13076030548

31 Jan 2025 03:44PM UTC coverage: 79.373% (+1.3%) from 78.037%
13076030548

Pull #234

github

web-flow
Merge 9d7378884 into 04cb83a80
Pull Request #234: Codebase health checkup

178 of 217 new or added lines in 45 files covered. (82.03%)

2 existing lines in 2 files now uncovered.

2559 of 3224 relevant lines covered (79.37%)

35.52 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

© 2026 Coveralls, Inc