abstract class AbstractPolicy

Constants

GLOBAL

ALLOW

DENY

FORCE_ALLOW

FORCE_DENY

Methods

allow()

No description

deny()

No description

forceAllow()

No description

forceDeny()

No description

string|void
checkAbility(User $actor, string $ability, $instance)

No description

string|void
sanitizeResult(mixed $result)

<p>Allows <code>true</code> to be used in place of <code>-&gt;allow()</code>, and <code>false</code> instead of <code>-&gt;deny()</code> This allows more concise and intuitive code, by returning boolean statements:.</p>

Details

protected allow()

protected deny()

protected forceAllow()

protected forceDeny()

string|void checkAbility(User $actor, string $ability, $instance)

Parameters

User $actor
string $ability
$instance

Return Value

string|void

string|void sanitizeResult(mixed $result)

<p>Allows <code>true</code> to be used in place of <code>-&gt;allow()</code>, and <code>false</code> instead of <code>-&gt;deny()</code> This allows more concise and intuitive code, by returning boolean statements:.</p>

<p>WITHOUT THIS: `return SOME_BOOLEAN_LOGIC ? $this-&gt;allow() : $this-&gt;deny();</p> <p>WITH THIS: `return SOME_BOOLEAN_LOGIC;</p>

Parameters

mixed $result

Return Value

string|void