A

ApprovalsServiceProvider — Class in namespace ReynoTECH\Approvals

Registers the config and migrations of the package.

ApprovesChanges — Class in namespace ReynoTECH\Approvals\Concerns

Applied to the model that casts approvals/disapprovals on a Modification (e.g. your User model).

ApprovesChanges::authorizedToApprove() — Method in class ApprovesChanges

Whether this model may approve the change. Override it to add your rules.

ApprovesChanges::authorizedToDisapprove() — Method in class ApprovesChanges

Whether this model may reject the change. Override it to add your rules.

ApprovesChanges::approve() — Method in class ApprovesChanges

Vote to approve a modification, or every pending item if it has any.

ApprovesChanges::approveItem() — Method in class ApprovesChanges

Vote to approve a single item, without touching the others.

ApprovesChanges::approvals() — Method in class ApprovesChanges

The approvals cast by this model.

HasModificationMedia::addImage() — Method in class HasModificationMedia

Attach an image to the main media collection.

$ RequiresApprovalWhenChanges#approversRequired — Property in class RequiresApprovalWhenChanges

Approvers needed to approve a change. To use another value, override approversRequired().

RequiresApprovalWhenChanges::approversRequired() — Method in class RequiresApprovalWhenChanges

Approvers needed to apply a change. Override it to raise the number: the trait's property can't be redeclared with another default on the class using the trait (PHP fatal error).

RequiresApprovalWhenChanges::approvalCreationMode() — Method in class RequiresApprovalWhenChanges

How a model implementing GatesCreation holds a creation until it's approved.

RequiresApprovalWhenChanges::approvalDraftColumn() — Method in class RequiresApprovalWhenChanges

The boolean column marking a row as waiting for approval in draft mode.

RequiresApprovalWhenChanges::approvableItemGroups() — Method in class RequiresApprovalWhenChanges

Opt-in: return the field groups that should be decided independently of one another, e.g. ['rules' => ['rules'], 'notes' => ['notes']].

RequiresApprovalWhenChanges::applyModificationChanges() — Method in class RequiresApprovalWhenChanges

Carry out a decision on a modification. Votes call this once they reach the required count.

RequiresApprovalWhenChanges::applyModificationItemChanges() — Method in class RequiresApprovalWhenChanges

Applies (or rejects) a single ModificationItem's proposed values, touching only the fields captured in that item.

Approvable — Class in namespace ReynoTECH\Approvals\Contracts

Implemented by models that use the RequiresApprovalWhenChanges concern: models whose changes can be captured as a pending Modification instead of being saved directly.

Approvable::applyModificationChanges() — Method in class Approvable

Carry out a decision on a modification, once enough votes are in. Runs in the vote's transaction.

Approver — Class in namespace ReynoTECH\Approvals\Contracts

Implemented by models that use the ApprovesChanges concern: models that can cast an approval/disapproval on a pending Modification.

Approver::approve() — Method in class Approver

Vote to approve a modification.

Approver::approvals() — Method in class Approver

The approvals cast by this model.

GatesCreation::approvalCreationMode() — Method in class GatesCreation

How a creation is held until it's approved.

GatesCreation::approvalDraftColumn() — Method in class GatesCreation

The boolean column marking a row as waiting for approval in draft mode.

Approval — Class in namespace ReynoTECH\Approvals\Models

One approver's vote for a modification or one of its items.

$ Approval#approver — Property in class Approval
Approval::approver() — Method in class Approval

The model that cast this vote.

$ Modification#active — Property in class Modification

Legacy flag, derived from flow and status.

$ Modification#approvers_required — Property in class Modification
$ Modification#approvers_remaining — Property in class Modification
Modification::approvals() — Method in class Modification

The approvals cast on this modification and on its items.

ModificationItem::approvals() — Method in class ModificationItem

The approvals cast on this item.

ApprovalDraftScope — Class in namespace ReynoTECH\Approvals\Scopes

Hides rows waiting for their creation to be approved on models in draft mode.

ApprovalDraftScope::apply() — Method in class ApprovalDraftScope

Leave out rows waiting for approval, on a model in draft mode.

ResolvesApprovalModels::approvalClass() — Method in class ResolvesApprovalModels

The class to use for approvals, from approvals.models.approval.

B

ApprovalsServiceProvider::boot() — Method in class ApprovalsServiceProvider

Load the migrations, and offer them and the config for publishing.

RequiresApprovalWhenChanges::bootRequiresApprovalWhenChanges() — Method in class RequiresApprovalWhenChanges

Register the model events that hold and audit saves.

Modification::booted() — Method in class Modification

C

RequiresApprovalWhenChanges::creations() — Method in class RequiresApprovalWhenChanges

Every creation recorded for this model, decided or not.

RequiresApprovalWhenChanges::currentOperationId() — Method in class RequiresApprovalWhenChanges

The operation id set with withOperationId().

RequiresApprovalWhenChanges::captureSave() — Method in class RequiresApprovalWhenChanges

Hold a save behind a pending Modification.

RequiresApprovalWhenChanges::captureModification() — Method in class RequiresApprovalWhenChanges

Prepare the audit row of a direct save, written once the save goes through.

$ Modification#context — Property in class Modification
Modification::casts() — Method in class Modification
ModificationItem::casts() — Method in class ModificationItem

D

ApprovesChanges::disapprove() — Method in class ApprovesChanges

Vote to reject a modification, or every pending item if it has any.

ApprovesChanges::disapproveItem() — Method in class ApprovesChanges

Vote to reject a single item, without touching the others.

ApprovesChanges::disapprovals() — Method in class ApprovesChanges

The disapprovals cast by this model.

$ RequiresApprovalWhenChanges#disapproversRequired — Property in class RequiresApprovalWhenChanges

Disapprovers needed to reject a change. To use another value, override disapproversRequired().

$ RequiresApprovalWhenChanges#deleteWhenDisapproved — Property in class RequiresApprovalWhenChanges

Whether rejecting deletes the Modification instead of marking it as rejected.

$ RequiresApprovalWhenChanges#deleteWhenApproved — Property in class RequiresApprovalWhenChanges

Whether approving deletes the Modification instead of marking it as approved.

RequiresApprovalWhenChanges::disapproversRequired() — Method in class RequiresApprovalWhenChanges

Disapprovers needed to reject a change. See approversRequired().

Approver::disapprove() — Method in class Approver

Vote to reject a modification.

Approver::disapprovals() — Method in class Approver

The disapprovals cast by this model.

Disapproval — Class in namespace ReynoTECH\Approvals\Models

One disapprover's vote against a modification or one of its items.

$ Disapproval#disapprover — Property in class Disapproval
Disapproval::disapprover() — Method in class Disapproval

The model that cast this vote.

$ Modification#disapprovers_required — Property in class Modification
$ Modification#disapprovers_remaining — Property in class Modification
Modification::disapprovals() — Method in class Modification

The disapprovals cast on this modification and on its items.

ModificationItem::disapprovals() — Method in class ModificationItem

The disapprovals cast on this item.

ResolvesApprovalModels::disapprovalClass() — Method in class ResolvesApprovalModels

The class to use for disapprovals, from approvals.models.disapproval.

E

$ Modification#event_type — Property in class Modification
ApprovalDraftScope::extend() — Method in class ApprovalDraftScope

Add the withApprovalDrafts() and onlyApprovalDrafts() query methods.

F

RequiresApprovalWhenChanges::forceModification() — Method in class RequiresApprovalWhenChanges

Make the next save produce a Modification even if nothing changed, to record or decide something outside the columns: an applied audit row, or a pending request if the gate holds the save.

$ Modification#flow — Property in class Modification

One of the FLOW_ constants.

Modification::forceApprovalUpdate() — Method in class Modification

Skips the votes, not the rules: only a pending change can be forced, and a rejected item stays rejected. Anything else would overwrite whatever changed since it was decided.

Modification::forceApprovalCreate() — Method in class Modification

forceApprovalUpdate() for a creation, refusing anything else: a query that went wrong must not apply a change to an existing row under this name.

G

RequiresApprovalWhenChanges::getLastModification() — Method in class RequiresApprovalWhenChanges

The last Modification this instance created or matched.

GatesCreation — Class in namespace ReynoTECH\Approvals\Contracts

Implemented by models whose creation can need approval. They also use the RequiresApprovalWhenChanges concern, which handles the two available modes:

$ Approval#guarded — Property in class Approval
$ Disapproval#guarded — Property in class Disapproval
$ Modification#guarded — Property in class Modification
Modification::getApproversRemainingAttribute() — Method in class Modification

Approvals still missing, read as approvers_remaining. Votes on items don't count.

Modification::getDisapproversRemainingAttribute() — Method in class Modification

Disapprovals still missing, read as disapprovers_remaining. Votes on items don't count.

Modification::getApprovalsRemainingAttribute() — Method in class Modification
Modification::getDisapprovalsRemainingAttribute() — Method in class Modification
$ ModificationItem#guarded — Property in class ModificationItem
ModificationItem::getApproversRemainingAttribute() — Method in class ModificationItem

Approvals still missing, read as approvers_remaining.

ModificationItem::getDisapproversRemainingAttribute() — Method in class ModificationItem

Disapprovals still missing, read as disapprovers_remaining.

H

HasModificationMedia — Class in namespace ReynoTECH\Approvals\Concerns

Optional: apply to a Modification subclass (which must also implement Spatie\MediaLibrary\HasMedia and use InteractsWithMedia) to allow attaching images to a pending change. Requires spatie/laravel-medialibrary, which this package does not depend on directly.

I

HasModificationMedia::imageLoad() — Method in class HasModificationMedia

The name, the label and the URL of each requested size of an image.

RequiresApprovalWhenChanges::isForcedApprovalUpdate() — Method in class RequiresApprovalWhenChanges

Whether the next save skips the approval gate.

$ Modification#is_update — Property in class Modification

False for a creation.

$ Modification#is_modification — Property in class Modification

Legacy flag, derived from flow and status.

Modification::items() — Method in class Modification

The separately decidable parts of this change, if the model defines any.

Modification::isPending() — Method in class Modification

Whether this row is still waiting for a decision. Anything else, including a direct audit row, can't take a vote: applying it again would overwrite whatever changed since.

Modification::isCreation() — Method in class Modification

Whether this requests or records a new row, not a change to an existing one.

M

RequiresApprovalWhenChanges::modifications() — Method in class RequiresApprovalWhenChanges

The modifications recorded for this model.

RequiresApprovalWhenChanges::modifier() — Method in class RequiresApprovalWhenChanges

Returns the model that should be recorded as the author of the change.

Approvable::modifications() — Method in class Approvable

The modifications recorded for this model.

$ Approval#modification_id — Property in class Approval
$ Approval#modification_item_id — Property in class Approval

Null when the vote is on the whole modification.

Approval::modification() — Method in class Approval

The modification this vote belongs to.

Approval::modificationItem() — Method in class Approval

The item this vote is on, if it isn't on the whole modification.

$ Disapproval#modification_id — Property in class Disapproval
$ Disapproval#modification_item_id — Property in class Disapproval

Null when the vote is on the whole modification.

Disapproval::modification() — Method in class Disapproval

The modification this vote belongs to.

Disapproval::modificationItem() — Method in class Disapproval

The item this vote is on, if it isn't on the whole modification.

Modification — Class in namespace ReynoTECH\Approvals\Models

A change to a model: an audit row if it was saved directly, or a request if it's waiting for approval.

$ Modification#modifiable_type — Property in class Modification
$ Modification#modifiable_id — Property in class Modification

Null until a deferred creation is approved.

$ Modification#modifier_type — Property in class Modification
$ Modification#modifier_id — Property in class Modification
$ Modification#md5 — Property in class Modification

Identifies an identical pending change.

$ Modification#modifications — Property in class Modification

The diff, keyed by attribute.

$ Modification#meta — Property in class Modification
Modification::modifiable() — Method in class Modification

The model this change belongs to.

Modification::modifier() — Method in class Modification

The model recorded as the author of the change.

Modification::modifiableClass() — Method in class Modification

The modifiable class, resolving a morph alias.

Modification::modifiableWithDrafts() — Method in class Modification

The modifiable, including a row hidden while its creation waits for approval, which the modifiable relation can't see.

ModificationItem — Class in namespace ReynoTECH\Approvals\Models

A single decidable unit inside a Modification, used only when a model opts into per-field/per-group approval via approvableItemGroups(). A Modification with no items is decided as a whole (legacy behavior).

ModificationItem::modification() — Method in class ModificationItem

The modification this item is part of.

ResolvesApprovalModels::modificationClass() — Method in class ResolvesApprovalModels

The class to use for modifications, from approvals.models.modification.

ResolvesApprovalModels::modificationItemClass() — Method in class ResolvesApprovalModels

The class to use for modification items, from approvals.models.modification_item.

N

RequiresApprovalWhenChanges::noSaveModifications() — Method in class RequiresApprovalWhenChanges

Stop recording audit rows for this instance's direct saves.

O

$ Modification#operation_id — Property in class Modification
$ Modification#occurred_at — Property in class Modification

When the change was requested or saved.

P

RequiresApprovalWhenChanges::pendingCreations() — Method in class RequiresApprovalWhenChanges

Creations of this model still waiting for a decision. In deferred mode this is the only way to reach them, since there's no model yet to ask for its modifications().

R

ApprovalsServiceProvider::register() — Method in class ApprovalsServiceProvider

Merge the package config under the approvals key.

HasModificationMedia::registerMediaConversions() — Method in class HasModificationMedia

Register the thumb (300x200) and normal (800x600) image conversions.

RequiresApprovalWhenChanges — Class in namespace ReynoTECH\Approvals\Concerns

Applied to the model whose changes should go through an approval workflow.

RequiresApprovalWhenChanges::requiresApprovalWhen() — Method in class RequiresApprovalWhenChanges

Rule that decides when an approval process should be triggered for this model. Override directly, or define a requiresApprovalWhenTrait method to keep this concern free for other traits to compose.

RequiresApprovalWhenChanges::requiresApproval() — Method in class RequiresApprovalWhenChanges

Gate this instance with a callback on every later save.

RequiresApprovalWhenChanges::recordModification() — Method in class RequiresApprovalWhenChanges

Explicit history API for events that don't go through saving (creation, deletion, attachments, signatures, external integrations).

GatesCreation::requiresApprovalOnCreate() — Method in class GatesCreation

Whether creating a model with these attributes needs approval.

$ Approval#reason — Property in class Approval
$ Disapproval#reason — Property in class Disapproval
Modification::recalculateStatusFromItems() — Method in class Modification

Recomputes this modification's status from its items' statuses.

ResolvesApprovalModels — Class in namespace ReynoTECH\Approvals\Support

Resolves the model classes to use for modifications/approvals/disapprovals, honoring the approvals.models.* config so consuming apps can swap in their own subclasses without forking the package.

S

RequiresApprovalWhenChanges::setForcedApprovalUpdate() — Method in class RequiresApprovalWhenChanges

Make the next save skip the approval gate. It covers that save only.

RequiresApprovalWhenChanges::setLastModification() — Method in class RequiresApprovalWhenChanges

Set what getLastModification() returns.

$ Modification#status — Property in class Modification

One of the STATUS_ constants.

Modification::syncLegacyFlags() — Method in class Modification

Derives the legacy active/is_modification booleans from flow/ status, so old consumers reading those columns keep working without changes: direct/applied => inactive audit row; approval/pending => active pending row; approval/approved|rejected|partially_resolved => inactive, resolved row.

Modification::scopeActiveOnly() — Method in class Modification

Only the rows flagged active, which are the pending ones.

Modification::scopeInactiveOnly() — Method in class Modification

Only the rows not flagged active: audit rows and decided changes.

Modification::scopeChanges() — Method in class Modification

Only changes to existing rows.

Modification::scopeCreations() — Method in class Modification

Only creations.

ModificationItem::scopePending() — Method in class ModificationItem

Only the items waiting for a decision.

T

$ Approval#table — Property in class Approval
$ Disapproval#table — Property in class Disapproval
$ Modification#table — Property in class Modification
$ ModificationItem#table — Property in class ModificationItem

U

$ RequiresApprovalWhenChanges#updateWhenApproved — Property in class RequiresApprovalWhenChanges

Whether approving writes the change to the model, or only marks it as approved.

V

VoteNotApplied — Class in namespace ReynoTECH\Approvals\Support

Undoes a whole decision from inside its transaction when one of its items couldn't be applied, so approve() can't leave a modification half decided. Never reaches the caller.

W

RequiresApprovalWhenChanges::withModificationMeta() — Method in class RequiresApprovalWhenChanges

Attach meta to the next Modification this instance produces.

RequiresApprovalWhenChanges::withFullSaveModification() — Method in class RequiresApprovalWhenChanges

Record the full attribute set instead of only the changed attributes.

RequiresApprovalWhenChanges::withFullSaveOnlyUpdateModification() — Method in class RequiresApprovalWhenChanges

Record the full attribute set, but only when an attribute changed.

RequiresApprovalWhenChanges::withOperationId() — Method in class RequiresApprovalWhenChanges

Tag the next Modifications of this instance with a shared operation id.