• 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

62.5
/src/Fields/Events.php
1
<?php
2

3
namespace Cone\Root\Fields;
4

5
use Closure;
6
use Cone\Root\Http\Controllers\RelationController;
7
use Illuminate\Database\Eloquent\Model;
8
use Illuminate\Http\Request;
9
use Illuminate\Routing\Router;
10

11
class Events extends MorphMany
12
{
13
    /**
14
     * Indicates whether the relation is a sub resource.
15
     */
16
    protected bool $asSubResource = true;
17

18
    /**
19
     * The relations to eager load on every query.
20
     */
21
    protected array $with = [
22
        'user',
23
        'target',
24
    ];
25

26
    /**
27
     * Create a new relation field instance.
28
     */
29
    public function __construct(?string $label = null, Closure|string|null $modelAttribute = 'rootEvents', Closure|string|null $relation = null)
198✔
30
    {
31
        parent::__construct($label ?: __('Events'), $modelAttribute, $relation);
198✔
32

33
        $this->hiddenOn(['index']);
198✔
34
    }
35

36
    /**
37
     * {@inheritdoc}
38
     */
39
    public function persist(Request $request, Model $model, mixed $value): void
×
40
    {
41
        //
42
    }
×
43

44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function resolveHydrate(Request $request, Model $model, mixed $value): void
×
48
    {
49
        //
50
    }
×
51

52
    /**
53
     * {@inheritdoc}
54
     */
55
    public function routes(Router $router): void
198✔
56
    {
57
        $router->get('/', [RelationController::class, 'index']);
198✔
58
        $router->get("/{{$this->getRouteKeyName()}}", [RelationController::class, 'show']);
198✔
59
    }
60

61
    /**
62
     * {@inheritdoc}
63
     */
64
    public function mapRelationAbilities(Request $request, Model $model): array
1✔
65
    {
66
        return [
1✔
67
            'viewAny' => $this->resolveAbility('viewAny', $request, $model),
1✔
68
            'create' => false,
1✔
69
        ];
1✔
70
    }
71

72
    /**
73
     * {@inheritdoc}
74
     */
75
    public function mapRelatedAbilities(Request $request, Model $model, Model $related): array
×
76
    {
77
        return [
×
78
            'view' => $this->resolveAbility('view', $request, $model, $related),
×
79
            'update' => false,
×
80
            'restore' => false,
×
81
            'delete' => false,
×
82
            'forceDelete' => false,
×
83
        ];
×
84
    }
85

86
    /**
87
     * {@inheritdoc}
88
     */
89
    public function fields(Request $request): array
198✔
90
    {
91
        return [
198✔
92
            ID::make()->sortable(),
198✔
93

94
            Text::make(__('Action'), 'action')->sortable(),
198✔
95

96
            BelongsTo::make(__('User'), 'user')
198✔
97
                ->display('name'),
198✔
98

99
            Date::make(__('Date'), 'created_at')
198✔
100
                ->withTime(),
198✔
101
        ];
198✔
102
    }
103
}
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