interface GatesCreation (View source)

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

  • DEFERRED: nothing is inserted until the creation is approved.
  • DRAFT: the row is inserted at once, hidden from queries until approved, and deleted if rejected. It needs a boolean column on the model's table.

The mode comes from approvals.creation.mode; override approvalCreationMode() to choose it per model.

Constants

DEFERRED

No row exists until the creation is approved.

DRAFT

The row exists from the start, hidden from queries until approved.

Methods

bool
requiresApprovalOnCreate(array $attributes)

Whether creating a model with these attributes needs approval.

string
approvalCreationMode()

How a creation is held until it's approved.

string
approvalDraftColumn()

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

Details

bool requiresApprovalOnCreate(array $attributes)

Whether creating a model with these attributes needs approval.

Parameters

array $attributes

Return Value

bool

string approvalCreationMode()

How a creation is held until it's approved.

Return Value

string

Either GatesCreation::DEFERRED or GatesCreation::DRAFT.

string approvalDraftColumn()

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

Return Value

string