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

conedevelopment / root / 15084089635

17 May 2025 10:00AM UTC coverage: 77.93% (+0.04%) from 77.891%
15084089635

push

github

web-flow
Modernize back-end.yml (#240)

3291 of 4223 relevant lines covered (77.93%)

36.04 hits per line

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

15.0
/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)
1✔
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, [
×
36
            'options' => array_map(static fn (array $option): array => array_merge($option, [
×
37
                'html' => View::make('root::fields.dropdown-option', $option)->render(),
×
38
            ]), $data['options']),
×
39
            'selection' => Collection::make($data['options'])
×
40
                ->filter(fn (array $option): bool => $option['selected'] ?? false)
×
41
                ->map(static fn (array $option): array => array_merge($option, [
×
42
                    'html' => View::make('root::fields.dropdown-option', $option)->render(),
×
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