• 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

75.0
/src/Widgets/Widgets.php
1
<?php
2

3
namespace Cone\Root\Widgets;
4

5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Http\Request;
7
use Illuminate\Routing\Router;
8
use Illuminate\Support\Arr;
9
use Illuminate\Support\Collection;
10

11
class Widgets extends Collection
12
{
13
    /**
14
     * Register the given widgets.
15
     */
16
    public function register(array|Widget $widgets): static
×
17
    {
18
        foreach (Arr::wrap($widgets) as $widget) {
×
19
            $this->push($widget);
×
20
        }
21

22
        return $this;
×
23
    }
24

25
    /**
26
     * Filter the fields that are available for the current request and model.
27
     */
28
    public function authorized(Request $request, ?Model $model = null): static
2✔
29
    {
30
        return $this->filter->authorized($request, $model)->values();
2✔
31
    }
32

33
    /**
34
     * Filter the fields that are visible in the given context.
35
     */
36
    public function visible(string|array $context): static
2✔
37
    {
38
        return $this->filter->visible($context)->values();
2✔
39
    }
40

41
    /**
42
     * Map the widgets to display.
43
     */
44
    public function mapToDisplay(Request $request): array
2✔
45
    {
46
        return $this->map->data($request)->all();
2✔
47
    }
48

49
    /**
50
     * Register the widget routes.
51
     */
52
    public function registerRoutes(Request $request, Router $router): void
198✔
53
    {
54
        $router->prefix('widgets')->group(function (Router $router) use ($request): void {
198✔
55
            $this->each(static function (Widget $widget) use ($request, $router): void {
198✔
56
                $widget->registerRoutes($request, $router);
198✔
57
            });
198✔
58
        });
198✔
59
    }
60
}
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