class PostPolicy extends AbstractPolicy

Constants

GLOBAL

ALLOW

DENY

FORCE_ALLOW

FORCE_DENY

Properties

protected SettingsRepositoryInterface $settings

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|null
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>

__construct(SettingsRepositoryInterface $settings)

No description

bool|null
can(User $actor, string $ability, Post $post)

No description

bool|null
edit(User $actor, Post $post)

No description

bool|null
hide(User $actor, Post $post)

No description

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|null 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|null

__construct(SettingsRepositoryInterface $settings)

Parameters

SettingsRepositoryInterface $settings

bool|null can(User $actor, string $ability, Post $post)

Parameters

User $actor
string $ability
Post $post

Return Value

bool|null

bool|null edit(User $actor, Post $post)

Parameters

User $actor
Post $post

Return Value

bool|null

bool|null hide(User $actor, Post $post)

Parameters

User $actor
Post $post

Return Value

bool|null