class NotificationResource extends AbstractDatabaseResource
Traits
Properties
| protected JsonApi | $api | from Bootable |
|
|
| protected Dispatcher | $events | from Bootable |
|
|
| protected Factory | $validation | from Bootable |
|
|
| static protected array | $endpointModifiers | from Extendable |
|
|
| static protected array | $fieldModifiers | from Extendable |
|
|
| static protected array | $sortModifiers | from Extendable |
|
|
| protected array|null | $cachedEndpoints | from Extendable |
|
|
| protected array|null | $cachedFields | from Extendable |
|
|
| protected array|null | $cachedSorts | from Extendable |
|
|
| protected bool | $initialized |
|
Methods
Called by the JSON:API server package to resolve the validation factory.
Dispatch all events for an entity.
No description
No description
No description
No description
No description
No description
Get the model property that a field represents.
Get the model method that a field represents.
No description
No description
Eager-load the polymorphic subject's own `state`/`discussion.state` so the notifications index does not issue a query per row for them (n+1).
Whether any registered notification subject type exposes an includable `discussion` relationship, making `subject.discussion` a valid include.
Details
Factory
validationFactory()
Called by the JSON:API server package to resolve the validation factory.
in Extendable
at
line 22
static void
mutateEndpoints(callable $modifier)
in Extendable
at
line 27
static void
mutateFields(callable $modifier)
in Extendable
at
line 32
static void
mutateSorts(callable $modifier)
in Extendable
at
line 37
array
resolveEndpoints(bool $earlyResolution = false)
in Extendable
at
line 56
array
resolveFields()
in Extendable
at
line 75
array
resolveSorts()
in HasSortMap
at
line 16
array
sortMap()
in DispatchEventsTrait
at
line 19
void
dispatchEventsFor(mixed $entity, User|null $actor = null)
Dispatch all events for an entity.
in AbstractResource
at
line 30
string|null
id(Context $context)
in AbstractResource
at
line 35
string|null
routeNamePrefix()
at
line 48
string
model()
string|null
resource(object $model, Context $context)
string
getId(object $model, Context $context)
mixed
getValue(object $model, Field $field, Context $context)
protected mixed
getAttributeValue(Model $model, Field $field, Context $context)
protected mixed
getRelationshipValue(Model $model, Relationship $field, Context $context)
at
line 58
object
query(Context $context)
at
line 53
void
scope(Builder $query, Context $context)
Hook to scope a query for this resource.
iterable
results(object $query, Context $context)
void
paginate(object $query, OffsetPagination $pagination)
int|null
count(object $query, Context $context)
object|null
find(string $id, Context $context)
void
setValue(object $model, Field $field, mixed $value, Context $context)
void
saveValue(object $model, Field $field, mixed $value, Context $context)
object
create(object $model, Context $context)
object
update(object $model, Context $context)
protected void
saveModel(Model $model, Context $context)
void
delete(object $model, Context $context)
protected string
property(Field $field)
Get the model property that a field represents.
protected string
method(Field $field)
Get the model method that a field represents.
object
newModel(Context $context)
final array
filters()
Filters that can be applied to the resource list.
array
mutateDataBeforeValidation(Context $context, array $data)
at
line 35
__construct(Dispatcher $bus, NotificationRepository $notifications, Repository $cache)
at
line 43
string
type()
at
line 72
array
endpoints()
at
line 117
protected void
eagerLoadSubject(Relation $query)
Eager-load the polymorphic subject's own `state`/`discussion.state` so the notifications index does not issue a query per row for them (n+1).
at
line 129
protected array
subjectMorphWith()
The nested relationships to eager-load per subject model type.
at
line 148
protected bool
subjectsHaveDiscussionRelationship()
Whether any registered notification subject type exposes an includable `discussion` relationship, making `subject.discussion` a valid include.