class PostPolicy extends 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>

__construct(SettingsRepositoryInterface $settings)

No description

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

No description

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

No description

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

No description

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

__construct(SettingsRepositoryInterface $settings)

Parameters

SettingsRepositoryInterface $settings

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

Parameters

User $actor
string $ability
Post $post

Return Value

string|null

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

Parameters

User $actor
Post $post

Return Value

string|null

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

Parameters

User $actor
Post $post

Return Value

string|null