• 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

78.95
/src/Actions/Actions.php
1
<?php
2

3
namespace Cone\Root\Actions;
4

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

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

23
        return $this;
×
24
    }
25

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

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

42
    /**
43
     * Filter the standalone actions.
44
     */
45
    public function standalone(bool $value = true): static
5✔
46
    {
47
        return $this->filter(static fn (Action $action): bool => $value ? $action->isStandalone() : ! $action->isStandalone());
5✔
48
    }
49

50
    /**
51
     * Map the action to forms.
52
     */
53
    public function mapToForms(Request $request, Model $model): array
5✔
54
    {
55
        return $this->map->toForm($request, $model)->all();
5✔
56
    }
57

58
    /**
59
     * Register the action routes.
60
     */
61
    public function registerRoutes(Request $request, Router $router): void
198✔
62
    {
63
        $router->prefix('actions')->group(function (Router $router) use ($request): void {
198✔
64
            $this->each(static function (Action $action) use ($request, $router): void {
198✔
65
                if (in_array(RegistersRoutes::class, class_uses_recursive($action))) {
198✔
66
                    $action->registerRoutes($request, $router);
198✔
67
                }
68
            });
198✔
69
        });
198✔
70
    }
71
}
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