interface Approvable (View source)

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

Methods

MorphMany
modifications()

The modifications recorded for this model.

void
applyModificationChanges(Modification $modification, bool $approved)

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

Details

MorphMany modifications()

The modifications recorded for this model.

Return Value

MorphMany

void applyModificationChanges(Modification $modification, bool $approved)

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

A class using the RequiresApprovalWhenChanges concern gets this for free. One implementing it by hand must close the modification: set status to approved or rejected, and save it. If it's still pending afterwards the decision counts as refused, with no exception: the vote and every database effect are undone, and approve()/disapprove() return false.

Parameters

Modification $modification
bool $approved

True to apply the change, false to reject it.

Return Value

void