abstract class AbstractPolicy

Constants

GLOBAL

ALLOW

DENY

FORCE_ALLOW

FORCE_DENY

Methods

string
allow()

No description

string
deny()

No description

string
forceAllow()

No description

string
forceDeny()

No description

string|null
checkAbility(User $actor, string $ability, AbstractModel|null $instance)

No description

string|null
sanitizeResult(string|bool|null $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 string allow()

Return Value

string

protected string deny()

Return Value

string

protected string forceAllow()

Return Value

string

protected string forceDeny()

Return Value

string

string|null checkAbility(User $actor, string $ability, AbstractModel|null $instance)

Parameters

User $actor
string $ability
AbstractModel|null $instance

Return Value

string|null

string|null sanitizeResult(string|bool|null $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

string|bool|null $result

Return Value

string|null