-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathViewRole.php
More file actions
43 lines (36 loc) · 1.4 KB
/
Copy pathViewRole.php
File metadata and controls
43 lines (36 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
declare(strict_types=1);
namespace NyonCode\WireModuleUsers\Pages;
use Illuminate\Database\Eloquent\Builder;
use NyonCode\WireModuleUsers\Resources\RoleResource;
use NyonCode\WireModuleUsers\Support\Teams;
use NyonCode\WirePanels\Resources\Concerns\InteractsWithRecordTitle;
use NyonCode\WirePanels\Resources\Concerns\ResolvesScopedRecord;
use NyonCode\WirePanels\Resources\Pages\ViewPage;
/**
* One role, read-only.
*
* A role used to be edit-or-nothing, on the argument that a name and a list of
* permission names is everything an edit form already shows. That argument only
* holds while the list is short. A role carrying forty permissions is a
* multi-select with forty chips inside a control sized for picking, and reading
* it means scrolling a widget built for choosing — so the answer to "what can
* this role actually do" is the one screen the module did not have.
*
* What this adds over the form is grouping: what the role *is* on top, what it
* *grants* underneath, and wildcards apart from the permissions they cover.
*/
class ViewRole extends ViewPage
{
use InteractsWithRecordTitle;
use ResolvesScopedRecord;
protected static ?string $resource = RoleResource::class;
protected function recordTitleAttribute(): string
{
return 'name';
}
protected function scopeRecordQuery(Builder $query): Builder
{
return Teams::scopeRoles($query);
}
}