class ToMany extends ToMany

Traits

Properties

protected array<array{rule: string| callable, condition: bool| callable}> $rules from HasValidationRules
protected string[] $validationMessages from HasValidationRules
protected string[] $validationAttributes from HasValidationRules
string|null $inverse from FlarumRelationship
bool $relatedScope Whether endpoints apply the related resource's scope() when they eager load this relationship. See withoutRelatedScope(). from FlarumRelationship

Methods

rules(array|string $rules, bool|callable $condition, bool $override = true)

No description

validationMessages(array $messages)

No description

validationAttributes(array $attributes)

No description

rule(string|callable $rule, bool|callable $condition = true)

No description

array
getRules()

No description

array
getValidationRules( Context $context)

No description

array
getValidationMessages( Context $context)

No description

array
getValidationAttributes( Context $context)

No description

required(bool|callable $condition = true)

No description

requiredWith(array $fields, bool|callable $condition)

No description

requiredWithout(array $fields, bool|callable $condition)

No description

requiredOnCreateWith(array $fields)

No description

requiredOnUpdateWith(array $fields)

No description

unique(string $table, string $column, bool $ignorable = false, bool|callable $condition = true)

No description

in(array $values, bool|callable $condition = true)

No description

notIn(array $values, bool|callable $condition = true)

No description

items(int $count, bool|callable $condition = true)

No description

mixed
evaluate( Context $context, mixed $callback)

No description

writableOnCreate()

Allow this field to be written to when creating a new model.

writableOnUpdate()

Allow this field to be written to when updating a model.

nullable(bool $nullable = true)

No description

withoutRelatedScope()

Have endpoints eager load this relationship in full, without the related resource's scope().

inverse(string $inverse)

Set the inverse relationship name, used for eager loading.

includable(bool $includable = true)

Allow this relationship to be included.

mixed
serializeValue(mixed $value, Context $context)

No description

Details

HasValidationRules rules(array|string $rules, bool|callable $condition, bool $override = true)

Parameters

array|string $rules
bool|callable $condition
bool $override

Return Value

HasValidationRules

HasValidationRules validationMessages(array $messages)

Parameters

array $messages

Return Value

HasValidationRules

HasValidationRules validationAttributes(array $attributes)

Parameters

array $attributes

Return Value

HasValidationRules

HasValidationRules rule(string|callable $rule, bool|callable $condition = true)

Parameters

string|callable $rule
bool|callable $condition

Return Value

HasValidationRules

array getRules()

Return Value

array

array getValidationRules( Context $context)

Parameters

Context $context

Return Value

array

array getValidationMessages( Context $context)

Parameters

Context $context

Return Value

array

array getValidationAttributes( Context $context)

Parameters

Context $context

Return Value

array

HasValidationRules required(bool|callable $condition = true)

Parameters

bool|callable $condition

Return Value

HasValidationRules

HasValidationRules requiredWith(array $fields, bool|callable $condition)

Parameters

array $fields
bool|callable $condition

Return Value

HasValidationRules

HasValidationRules requiredWithout(array $fields, bool|callable $condition)

Parameters

array $fields
bool|callable $condition

Return Value

HasValidationRules

HasValidationRules requiredOnCreateWith(array $fields)

Parameters

array $fields

Return Value

HasValidationRules

HasValidationRules requiredOnUpdateWith(array $fields)

Parameters

array $fields

Return Value

HasValidationRules

HasValidationRules requiredOnCreateWithout(array $fields)

Parameters

array $fields

Return Value

HasValidationRules

HasValidationRules requiredOnUpdateWithout(array $fields)

Parameters

array $fields

Return Value

HasValidationRules

HasValidationRules unique(string $table, string $column, bool $ignorable = false, bool|callable $condition = true)

Parameters

string $table
string $column
bool $ignorable
bool|callable $condition

Return Value

HasValidationRules

HasValidationRules in(array $values, bool|callable $condition = true)

Parameters

array $values
bool|callable $condition

Return Value

HasValidationRules

HasValidationRules notIn(array $values, bool|callable $condition = true)

Parameters

array $values
bool|callable $condition

Return Value

HasValidationRules

HasValidationRules items(int $count, bool|callable $condition = true)

Parameters

int $count
bool|callable $condition

Return Value

HasValidationRules

protected mixed evaluate( Context $context, mixed $callback)

Parameters

Context $context
mixed $callback

Return Value

mixed

FlarumField writableOnCreate()

Allow this field to be written to when creating a new model.

Return Value

FlarumField

FlarumField writableOnUpdate()

Allow this field to be written to when updating a model.

Return Value

FlarumField

FlarumField nullable(bool $nullable = true)

Parameters

bool $nullable

Return Value

FlarumField

FlarumRelationship withoutRelatedScope()

Have endpoints eager load this relationship in full, without the related resource's scope().

An endpoint applies the related resource's scope() to the relationships it eager loads, so that only what the actor may see is serialized. But the relation it loads is the model's own, and other code reads it too: a user's `groups`, for one, decide whether they are an admin and what they may do, and the policies that ask have to see every one of them, not only the ones the actor may see. Use this for a relationship that policies or other logic need to read in full. The field must then leave out what the actor may not see in its get() callback. With one, the serializer never loads the relationship itself, so endpoint eager loads are the only place this applies. Constraints given to eagerLoadWhere() still apply, and the rest of a path beyond this relationship is scoped as usual.

Return Value

FlarumRelationship

FlarumRelationship inverse(string $inverse)

Set the inverse relationship name, used for eager loading.

Parameters

string $inverse

Return Value

FlarumRelationship

FlarumRelationship includable(bool $includable = true)

Allow this relationship to be included.

Parameters

bool $includable

Return Value

FlarumRelationship

mixed serializeValue(mixed $value, Context $context)

Parameters

mixed $value
Context $context

Return Value

mixed